Nitrite/Flutter: Sorting stuff I'm running into #54
Replies: 2 comments
-
You can write your own entity converter in that case and for the enum fields you store the name values in the document instead of its index, then you will get what you are looking for.
Nitrite has a default sorting order for Null values like other databases which is - null has lowest of values. In descending order sort, null values goes at the last and in ascending order sort, null values comes first. Could you please give me a small reproducible code, so that I can better understand what your looking for and debug it to find the cause? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hey, I'm implementing sorting and trying to sort with each of my fields and noticed that my enum field can only be sorted by the index, which makes sense because that is what is being stored.
I can sort my enums and have it work off that, but it would be a pain when I decide to add more enum values because I believe that would require migrations to each object's stored index to that enum's new index
Any way to use a mapper with SortingOptions, so that it sorts by the enum's name instead of index?
Also, I'm trying to sort by a key-value pair in a map, but not all my objects have that key-value pair, and it ends up not sorting my result. When I sort by a key-value all my objects have, it sorts as expected.
I'm thinking that when it can't find the value in the map, the sorting operation breaks. I don't believe that's intentional, so something like a sortingOption for what to do when null values are encountered would be appreciated.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions