pub enum Expr {
Show 16 variants
Eq(AnyColumn, Value),
Ne(AnyColumn, Value),
Gt(AnyColumn, Value),
Gte(AnyColumn, Value),
Lt(AnyColumn, Value),
Lte(AnyColumn, Value),
Between(AnyColumn, Value, Value),
InList(AnyColumn, Vec<Value>),
NotIn(AnyColumn, Vec<Value>),
Like(AnyColumn, Value),
ILike(AnyColumn, Value),
IsNull(AnyColumn),
IsNotNull(AnyColumn),
And(Box<Expr>, Box<Expr>),
Or(Box<Expr>, Box<Expr>),
Not(Box<Expr>),
}Expand description
A composable SQL expression node.
Built via Column<T> methods, composed via .and(), .or(), .not().
Rendered to SQL + params via to_sql().
Variants§
Eq(AnyColumn, Value)
column = $N
Ne(AnyColumn, Value)
column != $N
Gt(AnyColumn, Value)
column > $N
Gte(AnyColumn, Value)
column >= $N
Lt(AnyColumn, Value)
column < $N
Lte(AnyColumn, Value)
column <= $N
Between(AnyColumn, Value, Value)
column BETWEEN $N AND $M
InList(AnyColumn, Vec<Value>)
column IN ($N, $M, ...) — empty list renders as 1=0
NotIn(AnyColumn, Vec<Value>)
column NOT IN ($N, $M, ...) — empty list renders as 1=1
Like(AnyColumn, Value)
column LIKE $N
ILike(AnyColumn, Value)
column ILIKE $N (case-insensitive, PostgreSQL)
IsNull(AnyColumn)
column IS NULL
IsNotNull(AnyColumn)
column IS NOT NULL
And(Box<Expr>, Box<Expr>)
(left AND right)
Or(Box<Expr>, Box<Expr>)
(left OR right)
Not(Box<Expr>)
NOT (expr)
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn to_sql(&self, sql: &mut String, params: &mut Vec<Value>, idx: &mut usize)
pub fn to_sql(&self, sql: &mut String, params: &mut Vec<Value>, idx: &mut usize)
Render this expression to a SQL string fragment, pushing parameters into params
and incrementing idx for each $N placeholder.
The idx counter is shared across the entire query so parameter numbers
are globally unique (e.g., a WHERE clause with 3 params followed by a
HAVING clause continues from $4).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> FlozRowBound for T
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>
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>
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