ormx
ormx copied to clipboard
Table:: All + Paginated + get_many queries lack "order by"
Firstly, thanks for a useful crate.
I have encountered an issue that seems to affect Table::all / all_paginated/ stream-all / stream_all_paginated / get_many. There appears to be no way currently to specify the order of the results and the order varies after updates or inserts, this makes the paginated functions not too useful. If I am mistaken could the documentation be changed to show how.
I am using postgres but as SQL does not guarantee an ordering for a select, this would apply to all databases. Sql standard states "If an
Would there be a way to specify at the Table level an "order by"
#[ormx(table = "...",order="id asc")] or for several #[ormx(table = "...",order="firstname asc, lastname asc")]
#[ormx(get_many,order="firstname asc, lastname asc"))]:
or if not then could you add an example to do order by, offset and limit using the conditional_query_as macro, and maybe clarify in the methods mentioned that the order is not guaranteed.
Thanks
That's a good point!
So I think that ORDER BY id DESC
would be an appropriate default ordering, but there needs to be a way of changing that.
Will work on this in the near future.