pub enum Expression<'a> {
Show 18 variants Binary { op: BinaryOperator, op_span: Span, lhs: Box<Expression<'a>>, rhs: Box<Expression<'a>>, }, Unary { op: UnaryOperator, op_span: Span, operand: Box<Expression<'a>>, }, Subquery(Box<Statement<'a>>), Null(Span), Bool(boolSpan), String(SString<'a>), Integer((u64, Span)), Float((f64, Span)), Function(Function<'a>, Vec<Expression<'a>>, Span), Identifier(Vec<IdentifierPart<'a>>), Arg((usize, Span)), Exists(Box<Statement<'a>>), In { lhs: Box<Expression<'a>>, rhs: Vec<Expression<'a>>, in_span: Span, not_in: bool, }, Is(Box<Expression<'a>>, IsSpan), Invalid(Span), Case { case_span: Span, value: Option<Box<Expression<'a>>>, whens: Vec<When<'a>>, else_: Option<(Span, Box<Expression<'a>>)>, end_span: Span, }, Cast { cast_span: Span, expr: Box<Expression<'a>>, as_span: Span, type_: DataType<'a>, }, Count { count_span: Span, distinct_span: Option<Span>, expr: Box<Expression<'a>>, },
}
Expand description

Representation of an expression

Variants

Binary

Fields

op: BinaryOperator

The operator to apply

op_span: Span

The span of the operator

lhs: Box<Expression<'a>>

Expression on the left hand side

rhs: Box<Expression<'a>>

Expression on the right hand side

Expression with binary operator

Unary

Fields

op: UnaryOperator

The operator to apply

op_span: Span

The span of the operator

operand: Box<Expression<'a>>

The expression on the right hand side

Expression with a unary (prefix) operator

Subquery(Box<Statement<'a>>)

Subquery expression

Null(Span)

Literal NULL expression

Bool(boolSpan)

Literal bool expression “TRUE” or “FALSE”

String(SString<'a>)

Literal string expression, the SString contains the represented string with escaping removed

Integer((u64, Span))

Literal integer expression

Float((f64, Span))

Literal floating point expression

Function(Function<'a>, Vec<Expression<'a>>, Span)

Function call expression,

Identifier(Vec<IdentifierPart<'a>>)

Identifier pointing to column

Arg((usize, Span))

Input argument to query, the first argument is the occurrence number of the argumnet

Exists(Box<Statement<'a>>)

Exists expression

In

Fields

lhs: Box<Expression<'a>>

Left hand side expression

rhs: Vec<Expression<'a>>

Right hand side expression

in_span: Span

Span of “IN” or “NOT IN”

not_in: bool

True if not in

In expression

Is(Box<Expression<'a>>, IsSpan)

Is expression

Invalid(Span)

Invalid expression, returned on recovery of a parse error

Case

Fields

case_span: Span

Span of “CASE”

value: Option<Box<Expression<'a>>>

Optional value to switch over

whens: Vec<When<'a>>

When parts

else_: Option<(Span, Box<Expression<'a>>)>

Span of “ELSE” and else value if specified

end_span: Span

Span of “END”

Case expression

Cast

Fields

cast_span: Span

Span of “CAST”

expr: Box<Expression<'a>>

Value to cast

as_span: Span

Span of “AS”

type_: DataType<'a>

Type to cast to

Cast expression

Count

Fields

count_span: Span

Span of “COUNT”

distinct_span: Option<Span>

Span of “DISTINCT” if specified

expr: Box<Expression<'a>>

Expression to count

Count expression

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Compute byte span of an ast fragment

Compute the minimal span containing both self and other

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.