Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 24 variants Star, QualifiedStar(String), Default, Column(String), QualifiedColumn { qualifier: String, column: String, }, Literal(Value), Param(usize), Func { name: String, binding: Option<FunctionBinding>, args: Vec<Expr>, distinct: bool, order_by: Vec<OrderBy>, filter: Option<Box<Expr>>, }, Array(Vec<Expr>), Row(Vec<Expr>), Binary { op: BinaryOp, lhs: Box<Expr>, rhs: Box<Expr>, }, UnaryMinus(Box<Expr>), Not(Box<Expr>), And(Vec<Expr>), Or(Vec<Expr>), IsNull { expr: Box<Expr>, negated: bool, }, Between { expr: Box<Expr>, low: Box<Expr>, high: Box<Expr>, }, InList { expr: Box<Expr>, list: Vec<Expr>, negated: bool, }, WindowCall { name: String, args: Vec<Expr>, spec: WindowSpec, }, Case { base: Option<Box<Expr>>, when: Vec<(Expr, Expr)>, else_branch: Option<Box<Expr>>, }, Cast { expr: Box<Expr>, ty: String, }, ScalarSubquery(Box<SelectStmt>), Exists { body: Box<SelectStmt>, negated: bool, }, InSubquery { expr: Box<Expr>, body: Box<SelectStmt>, negated: bool, }, // some variants omitted
}
Expand description

Scalar expression nodes the compiler handles.

Variants§

§

Star

§

QualifiedStar(String)

Relation-qualified wildcard projection (table.* or alias.*).

§

Default

DEFAULT in an INSERT/UPDATE assignment. This is a mutation marker, not a scalar value, and must be resolved against the target column before expression evaluation.

§

Column(String)

Unqualified column reference (col).

§

QualifiedColumn

Qualified column reference (table.col or alias.col).

Fields

§qualifier: String
§column: String
§

Literal(Value)

§

Param(usize)

A positional bind parameter ($1, $2, …).

§

Func

text_match(...), knn_match(...), etc. - dispatched through the function registry.

Fields

§name: String
§args: Vec<Expr>
§distinct: bool

func(DISTINCT expr) - only meaningful for aggregate functions. Mirrors PostgreSQL’s agg_distinct.

§order_by: Vec<OrderBy>

func(expr ORDER BY ...) - only meaningful for ordered aggregates (STRING_AGG, ARRAY_AGG, PERCENTILE_*).

§filter: Option<Box<Expr>>

func(...) FILTER (WHERE expr) - aggregate-level row filter.

§

Array(Vec<Expr>)

ARRAY[1.0, 2.0, ...] literal - currently restricted to numeric elements (vectors).

§

Row(Vec<Expr>)

Anonymous SQL row constructor (ROW(...) or (a, b)).

§

Binary

lhs op rhs - comparison or arithmetic.

Fields

§lhs: Box<Expr>
§rhs: Box<Expr>
§

UnaryMinus(Box<Expr>)

PostgreSQL prefix -, kept distinct from binary subtraction so the operand’s declared numeric width and overflow behavior survive lowering.

§

Not(Box<Expr>)

NOT expr.

§

And(Vec<Expr>)

cond_1 AND cond_2 AND ... (n-ary).

§

Or(Vec<Expr>)

cond_1 OR cond_2 OR ... (n-ary).

§

IsNull

expr IS NULL / expr IS NOT NULL.

Fields

§expr: Box<Expr>
§negated: bool
§

Between

expr BETWEEN low AND high.

Fields

§expr: Box<Expr>
§low: Box<Expr>
§high: Box<Expr>
§

InList

expr IN (a, b, c) literal list.

Fields

§expr: Box<Expr>
§list: Vec<Expr>
§negated: bool
§

WindowCall

func(args) OVER (PARTITION BY ... ORDER BY ...).

Fields

§name: String
§args: Vec<Expr>
§

Case

CASE [base] WHEN cond THEN result ... [ELSE default] END. base lifts simple-form CASE expr WHEN val THEN ... into an optional comparison anchor; searched-form CASE WHEN cond ... leaves it None.

Fields

§base: Option<Box<Expr>>
§when: Vec<(Expr, Expr)>
§else_branch: Option<Box<Expr>>
§

Cast

CAST(expr AS type). The type name is preserved verbatim so the evaluator can apply the correct coercion.

Fields

§expr: Box<Expr>
§

ScalarSubquery(Box<SelectStmt>)

(SELECT ...) scalar subquery: yields a single row / single column value at evaluation time.

§

Exists

EXISTS (SELECT ...) – truthy when the body produces at least one row.

Fields

§negated: bool
§

InSubquery

expr [NOT] IN (SELECT ...) set membership against a subquery. Evaluator runs the body once per top-level expression and tests membership.

Fields

§expr: Box<Expr>
§negated: bool

Implementations§

Source§

impl Expr

Source

pub fn qualified_column( qualifier: impl Into<String>, column: impl Into<String>, ) -> Self

Source

pub fn contains_window(&self) -> bool

True when this expression tree contains a window function call.

Source

pub fn contains_aggregate(&self) -> bool

True when this expression tree contains a built-in aggregate call.

Source

pub fn contains_unqualified_column(&self) -> bool

True when this expression contains a column whose owning relation can only be determined after catalog schemas have been bound.

Source

pub fn contains_function_with_unknown_strictness(&self) -> bool

True when this expression contains a function whose strictness cannot be decided without an engine catalog.

Source

pub fn any_node(&self, hit: &dyn Fn(&Self) -> bool) -> bool

Whether hit matches this node or any scalar node below it. Subquery bodies are opaque because they own independent query trees.

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

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<'de> Deserialize<'de> for Expr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Expr

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Expr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.