feat: add order-by logic to database queries - #491
Conversation
|
https://docs.rs/sea-query/latest/sea_query/query/trait.OrderedStatement.html I'm not exactly sure how to plug sea query into this? |
|
Right, updated it to use seaquery's own order_by method. I'm not getting the types down for the time being, will work on it more later. |
|
I have changed it so that instead of ordering on a string of the field name, it uses the fieldref identifier. Last bit is the ownership because it's not happy with the .clone() |
|
Hey @xelab04, how it's going with this PR? Do you need any help from us? |
|
Hey @xelab04, How's it going with this PR? We're thinking of getting this PR in for the next release planned for this week. I see this is mostly done, and if you don't mind, I would love to finish this if you don't have the time. |
|
Hi @ElijahAhianyo I had forgotten about this PR till recently because of a series of illnesses. My apologies. Yes, I remember having mostly completed the PR, but was particularly stumped with creating the proper tests for it. I'd be really happy if you could complete it; I'll also use the opportunity to better understand how I should have done it. I'm sorry it's been in draft for so long. |
Ah, no worries. I'll take this up from here and also wish you a speedy recovery. Thanks a lot for your contribution! |
…m order. API name needs to change though
| fn desc(&self) -> OrderByExpr; | ||
|
|
||
| /// Sorts rows by the position of this field's value | ||
| fn field_value<I>(&self, values: I) -> OrderByExpr |
There was a problem hiding this comment.
I'm not even sure if field_value is the right name here. I felt using field would be confusing since its technially not the field name. However mysql uses the term (Field). In fact, I started off with custom but that felt way too generic.
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Refer to #490