pub enum Expression<'a> {
Show 21 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(bool, Span), String(SString<'a>), Integer((u64, Span)), ListHack((usize, 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>>, Is, Span), 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>>, }, GroupConcat { group_concat_span: Span, distinct_span: Option<Span>, expr: Box<Expression<'a>>, }, Variable { global: Option<Span>, session: Option<Span>, dot: Option<Span>, variable: Variable<'a>, variable_span: Span, },
}
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(bool, Span)

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

§

ListHack((usize, Span))

Literal LIST

§

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>>, Is, Span)

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

§

GroupConcat

Fields

§group_concat_span: Span

Span of “GROUP_CONCAT”

§distinct_span: Option<Span>

Span of “DISTINCT” if specified

§expr: Box<Expression<'a>>

Expression to count

Group contat expression

§

Variable

Fields

§global: Option<Span>

Span of “@@GLOBAL”

§session: Option<Span>

Span of “@@SESSION”

§dot: Option<Span>

Span of ‘.’

§variable: Variable<'a>

variable

§variable_span: Span

Variable expression

Trait Implementations§

source§

impl<'a> Clone for Expression<'a>

source§

fn clone(&self) -> Expression<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Expression<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Spanned for Expression<'a>

source§

fn span(&self) -> Span

Compute byte span of an ast fragment
source§

fn join_span(&self, other: &impl OptSpanned) -> Span

Compute the minimal span containing both self and other

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Expression<'a>

§

impl<'a> Send for Expression<'a>

§

impl<'a> Sync for Expression<'a>

§

impl<'a> Unpin for Expression<'a>

§

impl<'a> UnwindSafe for Expression<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> OptSpanned for Twhere T: Spanned,

source§

fn opt_span(&self) -> Option<Range<usize>>

Compute an optional byte span of an ast fragment
source§

fn opt_join_span(&self, other: &impl OptSpanned) -> Option<Span>

Compute the minimal span containing both self and other if either is missing return the other
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.