Closed max-frai closed 5 years ago
And I found that it's not even possible to pass options directly to find_many
, for example. It takes default options directly without ability to replace them.
We can override options only defining own query with Query
trait, but, as I mentioned before, it's not possible to pass there dynamic information.
Hey there!
Good call, I'll look into this in a couple of days, hopefully tomorrow. I hope that all similar methods could be uniformly transformed into taking &self
.
@max-frai Added some &self
parameters where it made sense. Can you please check (by pointing your Cargo.toml
to the exact commit above ^^) that it is doing what you wanted?
Yes, exactly what I need. Now I can write something like:
fn options(&self) -> FindOptions {
FindOptions {
skip: Some(self.count * self.page),
limit: Some(self.count),
..Default::default()
}
}
Thank you! :)
No problem, I'll push a new version to crates.io in a moment.
@max-frai v0.4.0 published on crates.io.
Hi! I found that in
Query
trait method options (https://docs.rs/avocado/0.3.3/avocado/ops/trait.Query.html#method.options) is static method (does not have access to data). It's useful to access some inner data to configure, for example,count
andlimit
. I need this for pagination query where that params are dynamic for options but the same for filtering.