Skip to main content

Expr

Enum Expr 

Source
pub enum Expr<'bump> {
Show 24 variants Between { lhs: &'bump Expr<'bump>, not: bool, start: &'bump Expr<'bump>, end: &'bump Expr<'bump>, }, Binary(&'bump Expr<'bump>, Operator, &'bump Expr<'bump>), Case { base: Option<&'bump Expr<'bump>>, when_then_pairs: &'bump [(Expr<'bump>, Expr<'bump>)], else_expr: Option<&'bump Expr<'bump>>, }, Cast { expr: &'bump Expr<'bump>, type_name: Option<Type<'bump>>, }, Collate(&'bump Expr<'bump>, &'bump str), DoublyQualified(Name<'bump>, Name<'bump>, Name<'bump>), Exists(&'bump Select<'bump>), FunctionCall { name: Id<'bump>, distinctness: Option<Distinctness>, args: Option<&'bump [Expr<'bump>]>, order_by: Option<FunctionCallOrder<'bump>>, filter_over: Option<FunctionTail<'bump>>, }, FunctionCallStar { name: Id<'bump>, filter_over: Option<FunctionTail<'bump>>, }, Id(Id<'bump>), InList { lhs: &'bump Expr<'bump>, not: bool, rhs: Option<&'bump [Expr<'bump>]>, }, InSelect { lhs: &'bump Expr<'bump>, not: bool, rhs: &'bump Select<'bump>, }, InTable { lhs: &'bump Expr<'bump>, not: bool, rhs: QualifiedName<'bump>, args: Option<&'bump [Expr<'bump>]>, }, IsNull(&'bump Expr<'bump>), Like { lhs: &'bump Expr<'bump>, not: bool, op: LikeOperator, rhs: &'bump Expr<'bump>, escape: Option<&'bump Expr<'bump>>, }, Literal(Literal<'bump>), Name(Name<'bump>), NotNull(&'bump Expr<'bump>), Parenthesized(Vec<'bump, Expr<'bump>>), Qualified(Name<'bump>, Name<'bump>), Raise(ResolveType, Option<&'bump Expr<'bump>>), Subquery(&'bump Select<'bump>), Unary(UnaryOperator, &'bump Expr<'bump>), Variable(&'bump str),
}
Expand description

SQL expression

Variants§

§

Between

BETWEEN

Fields

§lhs: &'bump Expr<'bump>

expression

§not: bool

NOT

§start: &'bump Expr<'bump>

start

§end: &'bump Expr<'bump>

end

§

Binary(&'bump Expr<'bump>, Operator, &'bump Expr<'bump>)

binary expression

§

Case

CASE expression

Fields

§base: Option<&'bump Expr<'bump>>

operand

§when_then_pairs: &'bump [(Expr<'bump>, Expr<'bump>)]

WHEN condition THEN result

§else_expr: Option<&'bump Expr<'bump>>

ELSE result

§

Cast

CAST expression

Fields

§expr: &'bump Expr<'bump>

expression

§type_name: Option<Type<'bump>>

AS type name

§

Collate(&'bump Expr<'bump>, &'bump str)

COLLATE: expression

§

DoublyQualified(Name<'bump>, Name<'bump>, Name<'bump>)

schema-name.table-name.column-name

§

Exists(&'bump Select<'bump>)

EXISTS subquery

§

FunctionCall

call to a built-in function

Fields

§name: Id<'bump>

function name

§distinctness: Option<Distinctness>

DISTINCT

§args: Option<&'bump [Expr<'bump>]>

arguments

§order_by: Option<FunctionCallOrder<'bump>>

ORDER BY or WITHIN GROUP

§filter_over: Option<FunctionTail<'bump>>

FILTER

§

FunctionCallStar

Function call expression with ‘*’ as arg

Fields

§name: Id<'bump>

function name

§filter_over: Option<FunctionTail<'bump>>

FILTER

§

Id(Id<'bump>)

Identifier

§

InList

IN

Fields

§lhs: &'bump Expr<'bump>

expression

§not: bool

NOT

§rhs: Option<&'bump [Expr<'bump>]>

values

§

InSelect

IN subselect

Fields

§lhs: &'bump Expr<'bump>

expression

§not: bool

NOT

§rhs: &'bump Select<'bump>

subquery

§

InTable

IN table name / function

Fields

§lhs: &'bump Expr<'bump>

expression

§not: bool

NOT

§rhs: QualifiedName<'bump>

table name

§args: Option<&'bump [Expr<'bump>]>

table function arguments

§

IsNull(&'bump Expr<'bump>)

IS NULL

§

Like

LIKE

Fields

§lhs: &'bump Expr<'bump>

expression

§not: bool

NOT

§op: LikeOperator

operator

§rhs: &'bump Expr<'bump>

pattern

§escape: Option<&'bump Expr<'bump>>

ESCAPE char

§

Literal(Literal<'bump>)

Literal expression

§

Name(Name<'bump>)

Name

§

NotNull(&'bump Expr<'bump>)

NOT NULL or NOTNULL

§

Parenthesized(Vec<'bump, Expr<'bump>>)

Parenthesized subexpression

§

Qualified(Name<'bump>, Name<'bump>)

Qualified name

§

Raise(ResolveType, Option<&'bump Expr<'bump>>)

RAISE function call

§

Subquery(&'bump Select<'bump>)

Subquery expression

§

Unary(UnaryOperator, &'bump Expr<'bump>)

Unary expression

§

Variable(&'bump str)

Parameters

Implementations§

Source§

impl<'bump> Expr<'bump>

Source

pub fn parenthesized(x: Self, b: &'bump Bump) -> Self

Constructor

Source

pub fn id(xt: u16, x: Token<'_>, b: &'bump Bump) -> Self

Constructor

Source

pub fn collate(x: Self, ct: u16, c: Token<'_>, b: &'bump Bump) -> Self

Constructor

Source

pub fn cast(x: Self, type_name: Option<Type<'bump>>, b: &'bump Bump) -> Self

Constructor

Source

pub fn binary(left: Self, op: u16, right: Self, b: &'bump Bump) -> Self

Constructor

Source

pub fn ptr(left: Self, op: Token<'_>, right: Self, b: &'bump Bump) -> Self

Constructor

Source

pub fn like( lhs: Self, not: bool, op: LikeOperator, rhs: Self, escape: Option<Self>, b: &'bump Bump, ) -> Self

Constructor

Source

pub fn not_null(x: Self, op: u16, b: &'bump Bump) -> Self

Constructor

Source

pub fn unary(op: UnaryOperator, x: Self, b: &'bump Bump) -> Self

Constructor

Source

pub fn between( lhs: Self, not: bool, start: Self, end: Self, b: &'bump Bump, ) -> Self

Constructor

Source

pub fn in_list( lhs: Self, not: bool, rhs: Option<Vec<'bump, Self>>, b: &'bump Bump, ) -> Self

Constructor

Source

pub fn in_select( lhs: Self, not: bool, rhs: Select<'bump>, b: &'bump Bump, ) -> Self

Constructor

Source

pub fn in_table( lhs: Self, not: bool, rhs: QualifiedName<'bump>, args: Option<Vec<'bump, Self>>, b: &'bump Bump, ) -> Self

Constructor

Source

pub fn sub_query(query: Select<'bump>, b: &'bump Bump) -> Self

Constructor

Source

pub fn function_call( xt: u16, x: Token<'_>, distinctness: Option<Distinctness>, args: Option<Vec<'bump, Self>>, order_by: Option<FunctionCallOrder<'bump>>, filter_over: Option<FunctionTail<'bump>>, b: &'bump Bump, ) -> Result<Self, ParserError>

Constructor

Source

pub fn is_integer(&self) -> Option<i64>

Check if an expression is an integer

Trait Implementations§

Source§

impl<'bump> Debug for Expr<'bump>

Source§

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

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

impl Display for Expr<'_>

Source§

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

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

impl<'bump> Eq for Expr<'bump>

Source§

impl<'bump> PartialEq for Expr<'bump>

Source§

fn eq(&self, other: &Expr<'bump>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'bump> StructuralPartialEq for Expr<'bump>

Source§

impl ToTokens for Expr<'_>

Source§

fn to_tokens<S: TokenStream>(&self, s: &mut S) -> Result<(), S::Error>

Send token(s) to the specified stream
Source§

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

Format AST node

Auto Trait Implementations§

§

impl<'bump> !RefUnwindSafe for Expr<'bump>

§

impl<'bump> !Send for Expr<'bump>

§

impl<'bump> !Sync for Expr<'bump>

§

impl<'bump> !UnwindSafe for Expr<'bump>

§

impl<'bump> Freeze for Expr<'bump>

§

impl<'bump> Unpin for Expr<'bump>

§

impl<'bump> UnsafeUnpin for Expr<'bump>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.