pub enum Expr {
Show 14 variants
Star {
qualifier: Slice,
},
Column {
name: Slice,
},
Literal {
kind: LiteralKind,
text: StrRef,
},
Unary {
op: UnaryOp,
operand: ExprRef,
},
Binary {
op: BinaryOp,
left: ExprRef,
right: ExprRef,
},
Function {
name: Slice,
args: Slice,
distinct: bool,
},
Cast {
operand: ExprRef,
ty: StrRef,
try_cast: bool,
},
Case {
operand: ExprRef,
arms: Slice,
otherwise: ExprRef,
},
Between {
operand: ExprRef,
low: ExprRef,
high: ExprRef,
negated: bool,
},
In {
operand: ExprRef,
list: Slice,
negated: bool,
},
Parameter {
name: StrRef,
},
List {
items: Slice,
},
Row {
items: Slice,
},
Subquery {
query: QueryRef,
},
}Expand description
One expression.
Twenty four bytes, which is the widest variant rounded up. The precedence chain in the grammar
does not survive into here: twenty levels of X <- Y Tail* become one Expr::Binary tree,
because the levels exist to make the grammar unambiguous and mean nothing afterwards.
Variants§
Star
*, or t.* with a qualifier.
Column
A column reference, qualified or not.
Literal
A literal, kept as the text that was written.
Fields
kind: LiteralKindWhich kind.
Unary
A prefix or postfix operator.
Binary
An infix operator.
Fields
Function
A function call.
Fields
Cast
CAST(x AS t) or TRY_CAST(x AS t).
Fields
Case
CASE, searched or simple.
Fields
Between
x BETWEEN a AND b.
Fields
In
x IN (a, b, c).
Fields
Parameter
A prepared statement parameter, written ?, ?1, $1 or $name.
Fields
List
A bracketed list of expressions, [a, b, c], which is a LIST value.
Row
A parenthesised list of more than one expression, which is a row value.
Subquery
A scalar subquery, (SELECT ...) where an expression is expected.