pub enum Expr {
Show 24 variants
Star,
QualifiedStar(String),
Default,
Column(String),
QualifiedColumn {
qualifier: String,
column: String,
},
Literal(Value),
Param(usize),
Func {
name: String,
binding: Option<FunctionBinding>,
args: Vec<Expr>,
distinct: bool,
order_by: Vec<OrderBy>,
filter: Option<Box<Expr>>,
},
Array(Vec<Expr>),
Row(Vec<Expr>),
Binary {
op: BinaryOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
UnaryMinus(Box<Expr>),
Not(Box<Expr>),
And(Vec<Expr>),
Or(Vec<Expr>),
IsNull {
expr: Box<Expr>,
negated: bool,
},
Between {
expr: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
},
InList {
expr: Box<Expr>,
list: Vec<Expr>,
negated: bool,
},
WindowCall {
name: String,
args: Vec<Expr>,
spec: WindowSpec,
},
Case {
base: Option<Box<Expr>>,
when: Vec<(Expr, Expr)>,
else_branch: Option<Box<Expr>>,
},
Cast {
expr: Box<Expr>,
ty: String,
},
ScalarSubquery(Box<SelectStmt>),
Exists {
body: Box<SelectStmt>,
negated: bool,
},
InSubquery {
expr: Box<Expr>,
body: Box<SelectStmt>,
negated: bool,
},
}Expand description
Scalar expression nodes the compiler handles.
Variants§
Star
QualifiedStar(String)
Relation-qualified wildcard projection (table.* or alias.*).
Default
DEFAULT in an INSERT/UPDATE assignment. This is a mutation marker,
not a scalar value, and must be resolved against the target column
before expression evaluation.
Column(String)
Unqualified column reference (col).
QualifiedColumn
Qualified column reference (table.col or alias.col).
Literal(Value)
Param(usize)
A positional bind parameter ($1, $2, …).
Func
text_match(...), knn_match(...), etc. - dispatched through
the function registry.
Fields
binding: Option<FunctionBinding>distinct: boolfunc(DISTINCT expr) - only meaningful for aggregate
functions. Mirrors PostgreSQL’s agg_distinct.
Array(Vec<Expr>)
ARRAY[1.0, 2.0, ...] literal - currently restricted to numeric
elements (vectors).
Row(Vec<Expr>)
Anonymous SQL row constructor (ROW(...) or (a, b)).
Binary
lhs op rhs - comparison or arithmetic.
UnaryMinus(Box<Expr>)
PostgreSQL prefix -, kept distinct from binary subtraction so the
operand’s declared numeric width and overflow behavior survive lowering.
Not(Box<Expr>)
NOT expr.
And(Vec<Expr>)
cond_1 AND cond_2 AND ... (n-ary).
Or(Vec<Expr>)
cond_1 OR cond_2 OR ... (n-ary).
IsNull
expr IS NULL / expr IS NOT NULL.
Between
expr BETWEEN low AND high.
InList
expr IN (a, b, c) literal list.
WindowCall
func(args) OVER (PARTITION BY ... ORDER BY ...).
Case
CASE [base] WHEN cond THEN result ... [ELSE default] END.
base lifts simple-form CASE expr WHEN val THEN ... into an
optional comparison anchor; searched-form CASE WHEN cond ...
leaves it None.
Cast
CAST(expr AS type). The type name is preserved verbatim so
the evaluator can apply the correct coercion.
ScalarSubquery(Box<SelectStmt>)
(SELECT ...) scalar subquery: yields a single row / single
column value at evaluation time.
Exists
EXISTS (SELECT ...) – truthy when the body produces at
least one row.
InSubquery
expr [NOT] IN (SELECT ...) set membership against a
subquery. Evaluator runs the body once per top-level
expression and tests membership.
Implementations§
Source§impl Expr
impl Expr
pub fn qualified_column( qualifier: impl Into<String>, column: impl Into<String>, ) -> Self
Sourcepub fn contains_window(&self) -> bool
pub fn contains_window(&self) -> bool
True when this expression tree contains a window function call.
Sourcepub fn contains_aggregate(&self) -> bool
pub fn contains_aggregate(&self) -> bool
True when this expression tree contains a built-in aggregate call.
Sourcepub fn contains_unqualified_column(&self) -> bool
pub fn contains_unqualified_column(&self) -> bool
True when this expression contains a column whose owning relation can only be determined after catalog schemas have been bound.
Sourcepub fn contains_function_with_unknown_strictness(&self) -> bool
pub fn contains_function_with_unknown_strictness(&self) -> bool
True when this expression contains a function whose strictness cannot be decided without an engine catalog.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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