Enum sql_parse::Expression
source · [−]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(bool, Span),
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>>, 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>>,
},
}
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
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
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
Count expression
Trait Implementations
sourceimpl<'a> Clone for Expression<'a>
impl<'a> Clone for Expression<'a>
sourcefn clone(&self) -> Expression<'a>
fn clone(&self) -> Expression<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for Expression<'a>
impl<'a> Debug for Expression<'a>
sourceimpl<'a> Spanned for Expression<'a>
impl<'a> Spanned for Expression<'a>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more