Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
91 stars 13 forks source link

load_first method silently ignores order and offset #25

Closed joaommartins closed 1 year ago

joaommartins commented 1 year ago

When using the query! macro, the load_first() method silently ignores previously set self.sort and self.offset attributes, leading to unexpected query results.

Ignoring the previous self.limit attribute makes sense in this context, but ignoring the other attributes that change which row is first in the query is unexpected behaviour and can lead to bugs.

Expected behaviour here is, IMO, to return the correctly ordered and offset element when using load_first(), without modifying the self.limit attribute. This allows to reuse the same Query struct for other queries without running the risk of silently modifying the struct's attributes and returning unexpected query results.