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.
When using the query! macro, the
load_first()
method silently ignores previously setself.sort
andself.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 theself.limit
attribute. This allows to reuse the sameQuery
struct for other queries without running the risk of silently modifying the struct's attributes and returning unexpected query results.