pub struct Cond { /* private fields */ }Expand description
A boolean condition group under construction — the building block for
nested AND/OR filter trees. You don’t make one directly; a fresh Cond is
handed to the closure of Query::where_any / Query::where_all (and the
nested Cond::any / Cond::all). Add clauses by chaining, just like
Query.
No correlations here. A correlation (row.col(..)) is a property of an
EXISTS subquery, never of a free-standing condition, so Cond::where takes a
plain literal (impl IntoLit). To correlate, nest a Cond::where_exists
whose child query carries the row.col(..) link.
Implementations§
Source§impl Cond
impl Cond
Sourcepub fn where(self, field: &str, value: impl IntoLit) -> Cond
pub fn where(self, field: &str, value: impl IntoLit) -> Cond
field = value (a literal — see the type docs on why correlations don’t
belong in a group).
Sourcepub fn where_op(self, field: &str, op: impl IntoOp, value: impl IntoLit) -> Cond
pub fn where_op(self, field: &str, op: impl IntoOp, value: impl IntoLit) -> Cond
field <op> value with an explicit operator ("<", ">=", "LIKE", … or
an Op).
Sourcepub fn where_in<V: IntoLit>(
self,
field: &str,
values: impl IntoIterator<Item = V>,
) -> Cond
pub fn where_in<V: IntoLit>( self, field: &str, values: impl IntoIterator<Item = V>, ) -> Cond
field IN (values…).
Sourcepub fn where_exists(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
pub fn where_exists(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
EXISTS (<correlated subquery>) — same closure/correlation mechanism as
Query::where_exists.
Sourcepub fn where_exists_with(
self,
f: impl FnOnce(ParentRow) -> Query,
opts: ExistsOpts,
) -> Cond
pub fn where_exists_with( self, f: impl FnOnce(ParentRow) -> Query, opts: ExistsOpts, ) -> Cond
Cond::where_exists with ExistsOpts (e.g. { scalar: true }).
Sourcepub fn where_not_exists(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
pub fn where_not_exists(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
NOT EXISTS (<correlated subquery>).
Sourcepub fn where_not_exists_with(
self,
f: impl FnOnce(ParentRow) -> Query,
opts: ExistsOpts,
) -> Cond
pub fn where_not_exists_with( self, f: impl FnOnce(ParentRow) -> Query, opts: ExistsOpts, ) -> Cond
Sourcepub fn where_exists_no_sync(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
pub fn where_exists_no_sync(self, f: impl FnOnce(ParentRow) -> Query) -> Cond
EXISTS (<correlated subquery>) as a server-only, non-syncing gate — the nestable
form of Query::where_exists_no_sync.
Sourcepub fn where_not_exists_no_sync(
self,
f: impl FnOnce(ParentRow) -> Query,
) -> Cond
pub fn where_not_exists_no_sync( self, f: impl FnOnce(ParentRow) -> Query, ) -> Cond
NOT EXISTS (<correlated subquery>) as a server-only, non-syncing gate — the
nestable form of Query::where_not_exists_no_sync.