Skip to main content

Expr

Struct Expr 

Source
pub struct Expr {
    pub kind: ExprKind,
    pub ty: u32,
    pub typmod: i32,
    pub location: Option<usize>,
}
Expand description

An expression with its type and its typmod. A typmod of -1 means that the expression has no typmod.

Fields§

§kind: ExprKind§ty: u32

The OID of the type of the value.

§typmod: i32§location: Option<usize>

The byte offset in the query text of the place that the expression starts, for the position of an error, or None.

Implementations§

Source§

impl Expr

Source

pub fn new(kind: ExprKind, ty: u32) -> Expr

An expression with no typmod and no location.

Source

pub fn constant( value: Value, ty: u32, typmod: i32, location: Option<usize>, ) -> Expr

A constant.

Source

pub fn at(self, location: Option<usize>) -> Expr

Sets the location.

Source

pub fn as_const(&self) -> Option<&Value>

The value of a constant, or None for any other expression.

Source

pub fn own_cost(&self) -> f64

The cost of the calls of functions and operators in the node of this expression, without its children, in units of cpu_operator_cost, as cost_qual_eval_walker adds it. A call, an operator, NULLIF and IS DISTINCT FROM cost the procost of their function, as add_function_cost adds it.

Source

pub fn leaky(&self) -> bool

contain_leaked_vars: true when the expression can give information about a column of the query other than through its result, as a call of a function that is not leakproof with a column in its arguments does. An expression of a kind that the check does not know is leaky.

Source

pub fn children(&self) -> Vec<&Expr>

The expressions that this expression has as its arguments.

Source

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

equal of PostgreSQL: true when the two expressions are the same apart from their locations.

Source

pub fn find<'a, T>( &'a self, depth: usize, f: &mut impl FnMut(&'a Expr, usize) -> Option<T>, ) -> Option<T>

Calls f for the expression and for each expression in it, also in its subqueries, with the number of subqueries between the expression and this expression. The search stops at the first Some that f gives.

Source

pub fn first_var(&self) -> Option<&Expr>

The first column of the query of the expression that the expression reads, also in a subquery, as locate_var_of_level finds it with level 0.

Source

pub fn raise(&mut self, levels: usize)

IncrementVarSublevelsUp: the columns of the outer queries in the expression, also in its subqueries, are levels more levels up. A column of a query in the expression does not change.

Source

pub fn each_mut( &mut self, depth: usize, f: &mut impl FnMut(&mut Expr, usize) -> bool, )

expression_tree_mutator: calls f for the expression and for each expression in it, also in its subqueries, with the number of subqueries between the expression and this expression. f sees an expression before the expressions in it, and when f gives true, the walk does not go into the expression, as for an expression that f put in its place.

Source

pub fn map_attnos(&mut self, map: &[i16])

map_variable_attnos for an expression on one relation, such as a check constraint or an index expression: each column gets the number that map gives for it, the number in a partition for each column of its parent table. A system column and a whole-row column keep their numbers.

Source

pub fn lower(&mut self, levels: usize)

IncrementVarSublevelsUp with a negative delta: each column of a query outside the expression comes levels levels down, as the planner moves an aggregate of an outer query to that query. A column of a level that is less than levels levels up does not change.

Source

pub fn first_agg(&self) -> Option<&Expr>

contain_aggs_of_level and locate_agg_of_level: the first aggregate call or call of GROUPING in the expression.

Source

pub fn first_window(&self) -> Option<&Expr>

contain_windowfuncs and locate_windowfunc: the first call of a window function in the expression, outside its subqueries.

Source

pub fn first_set_call(&self) -> Option<&Expr>

expression_returns_set and exprLocation of the first call: the first call of a function that gives a set in the expression, outside its subqueries.

Source

pub fn strip_implicit(&self) -> &Expr

strip_implicit_coercions: the expression without the casts that the analyzer added.

Source

pub fn place(&self) -> Option<usize>

exprLocation: the place of the expression. For a call, an operator or a test it is the leftmost of the place of the node and the place of the first argument, as in PostgreSQL.

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 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.