macro_rules! query { ($model:ident, $filter:expr) => { ... }; }
Expand description
Constructs a filtered database query.
Use as query!(Foo, expr)
, where Foo
is a model type. Returns Query
<Foo>
.
Shorthand for Foo::query().filter(
filter
!(Foo, expr))
Examples
#[model]
struct Contestant {
#[pk]
name: String,
rank: i32,
nationality: String
}
let top_tier: Query<Contestant> = query!(Contestant, rank <= 10);