pub enum Pred {
Cmp {
field: String,
op: String,
value: Value,
},
In {
field: String,
values: Vec<Value>,
negated: bool,
},
Between {
field: String,
low: Value,
high: Value,
negated: bool,
},
Like {
field: String,
pattern: String,
negated: bool,
ci: bool,
},
IsNull {
field: String,
negated: bool,
},
And(Vec<Pred>),
Or(Vec<Pred>),
Not(Box<Pred>),
}Expand description
A boolean predicate tree.
The old representation was Vec<WhereClause> evaluated with .all(), which
can only ever express a conjunction of comparisons. A tree is required for
OR, for NOT, and for parenthesised grouping — WHERE (a = 1 OR b = 2) AND c != 3 has no encoding as a flat list.
Variants§
Cmp
field
In
field [NOT] IN (v1, v2, …)
Between
field [NOT] BETWEEN low AND high — inclusive on both ends, as in SQL.
Like
field [NOT] LIKE “pat” — SQL wildcards: % = any run, _ = any one char.
ci is set by ILIKE (case-insensitive).
IsNull
field IS [NOT] NULL — true when the field is JSON null OR absent.
And(Vec<Pred>)
Or(Vec<Pred>)
Not(Box<Pred>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pred
impl RefUnwindSafe for Pred
impl Send for Pred
impl Sync for Pred
impl Unpin for Pred
impl UnsafeUnpin for Pred
impl UnwindSafe for Pred
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more