Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 19 variants Literal(Literal), Parameter { index: u32, name: Option<NameId>, }, Column { database: Option<NameId>, table: Option<NameId>, column: NameId, }, Star { table: Option<NameId>, }, Unary { op: UnaryOp, operand: ExprId, }, Binary { op: BinaryOp, left: ExprId, right: ExprId, }, Collate { operand: ExprId, collation: NameId, }, Cast { operand: ExprId, declared: NameId, }, Pattern { negated: bool, op: PatternOp, operand: ExprId, pattern: ExprId, escape: Option<ExprId>, }, Between { negated: bool, operand: ExprId, low: ExprId, high: ExprId, }, In { negated: bool, operand: ExprId, rhs: InRhs, }, IsNull { negated: bool, operand: ExprId, }, Is { negated: bool, distinct_from: bool, left: ExprId, right: ExprId, }, Case { operand: Option<ExprId>, branches: Vec<(ExprId, ExprId)>, otherwise: Option<ExprId>, }, Function { name: NameId, distinct: bool, arguments: Option<Vec<ExprId>>, order_by: Vec<OrderTerm>, filter: Option<ExprId>, over: Option<WindowId>, }, Exists { negated: bool, select: SelectId, }, Subquery(SelectId), RowValue(Vec<ExprId>), Raise { action: RaiseAction, message: Option<ExprId>, },
}
Expand description

An expression, in the shape it was written.

Variants§

§

Literal(Literal)

A literal.

§

Parameter

A bound parameter.

Fields

§index: u32

The one-based parameter index assigned at parse time.

§name: Option<NameId>

The written name, for :name style parameters.

§

Column

A column reference, with as much qualification as was written.

Fields

§database: Option<NameId>

The schema qualifier.

§table: Option<NameId>

The table qualifier or alias.

§column: NameId

The column name.

§

Star

* or table.*, legal only where the grammar allows it.

Fields

§table: Option<NameId>

The table qualifier, when written.

§

Unary

A unary operator applied to one operand.

Fields

§op: UnaryOp

Which operator.

§operand: ExprId

The operand.

§

Binary

A binary operator applied to two operands.

Fields

§op: BinaryOp

Which operator.

§left: ExprId

The left operand.

§right: ExprId

The right operand.

§

Collate

expr COLLATE name.

Fields

§operand: ExprId

The operand.

§collation: NameId

The collation name.

§

Cast

CAST(expr AS type).

Fields

§operand: ExprId

The operand.

§declared: NameId

The declared type, as written.

§

Pattern

expr [NOT] LIKE|GLOB|REGEXP|MATCH pattern [ESCAPE expr].

Fields

§negated: bool

Whether NOT was written.

§op: PatternOp

Which operator.

§operand: ExprId

The value being matched.

§pattern: ExprId

The pattern.

§escape: Option<ExprId>

The ESCAPE argument, when written.

§

Between

expr [NOT] BETWEEN low AND high.

Fields

§negated: bool

Whether NOT was written.

§operand: ExprId

The value being tested.

§low: ExprId

The lower bound.

§high: ExprId

The upper bound.

§

In

expr [NOT] IN rhs.

Fields

§negated: bool

Whether NOT was written.

§operand: ExprId

The value being tested.

§rhs: InRhs

What it is tested against.

§

IsNull

expr ISNULL / expr NOTNULL / expr IS [NOT] NULL.

Fields

§negated: bool

Whether the test is for not-null.

§operand: ExprId

The operand.

§

Is

left IS [NOT] [DISTINCT FROM] right.

Fields

§negated: bool

Whether NOT was written.

§distinct_from: bool

Whether the DISTINCT FROM spelling was used.

§left: ExprId

The left operand.

§right: ExprId

The right operand.

§

Case

CASE [operand] WHEN ... THEN ... [ELSE ...] END.

Fields

§operand: Option<ExprId>

The base operand, when the form has one.

§branches: Vec<(ExprId, ExprId)>

The WHEN/THEN pairs, in written order.

§otherwise: Option<ExprId>

The ELSE arm.

§

Function

A function call, aggregate or scalar or window.

Fields

§name: NameId

The function name.

§distinct: bool

Whether DISTINCT was written.

§arguments: Option<Vec<ExprId>>

The arguments, or None for count(*).

§order_by: Vec<OrderTerm>

An ORDER BY inside the argument list.

§filter: Option<ExprId>

A FILTER (WHERE ...) clause.

§over: Option<WindowId>

An OVER clause.

§

Exists

[NOT] EXISTS (SELECT ...).

Fields

§negated: bool

Whether NOT was written.

§select: SelectId

The subquery.

§

Subquery(SelectId)

A scalar subquery.

§

RowValue(Vec<ExprId>)

A parenthesised list of two or more expressions.

§

Raise

RAISE(...), legal only inside a trigger body.

Fields

§action: RaiseAction

Which action.

§message: Option<ExprId>

The message, when the action takes one.

An expression, as SQLite takes it: RAISE(ABORT, 'too big: ' || NEW.n) names the value that broke the rule, which is the reason to write a guard trigger at all. It used to be a string literal only, and anything else was a syntax error pointing at the ||.

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

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

impl Eq for Expr

Source§

impl PartialEq for Expr

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnsafeUnpin for Expr

§

impl UnwindSafe for Expr

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 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> ToOwned for T
where T: Clone,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.