pub enum Expr {
Show 14 variants
Value(Value),
Field(FieldRef),
Binary {
left: Box<Expr>,
op: BinaryOp,
right: Box<Expr>,
},
Unary {
op: UnaryOp,
expr: Box<Expr>,
},
Func {
name: String,
args: Vec<Expr>,
},
Aggregate(AggregationDef),
Cast {
expr: Box<Expr>,
to_type: String,
},
Case(CaseDef),
Window(WindowDef),
Exists(Box<QueryStmt>),
SubQuery(Box<QueryStmt>),
ArraySubQuery(Box<QueryStmt>),
Raw {
sql: String,
params: Vec<Value>,
},
Custom(Box<dyn CustomExpr>),
}Expand description
An expression in a SQL statement.
Variants§
Value(Value)
Literal value.
Field(FieldRef)
Column reference.
Binary
Binary operation: left op right.
Unary
Unary operation: -expr, NOT expr.
Func
Function call: name(args...).
Aggregate(AggregationDef)
Aggregate function: COUNT(expr), SUM(DISTINCT expr) FILTER (WHERE ...).
Cast
Type cast: expr::type (PG) or CAST(expr AS type).
Case(CaseDef)
CASE WHEN … THEN … ELSE … END.
Window(WindowDef)
Window function: expr OVER (PARTITION BY ... ORDER BY ... frame).
Exists(Box<QueryStmt>)
EXISTS (subquery).
SubQuery(Box<QueryStmt>)
Scalar subquery.
ArraySubQuery(Box<QueryStmt>)
ARRAY(subquery).
Raw
Raw SQL with parameters (escape hatch).
Custom(Box<dyn CustomExpr>)
User-defined expression (extension point).
Implementations§
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
Mutably borrows from an owned value. Read more