ExprNode

Enum ExprNode 

Source
pub enum ExprNode<'a> {
Show 20 variants Expr(Cow<'a, Expr>), SqlExpr(Cow<'a, str>), Identifier(Cow<'a, str>), Numeric(NumericNode<'a>), QuotedString(Cow<'a, str>), TypedString { data_type: DataType, value: Cow<'a, str>, }, Between { expr: Box<ExprNode<'a>>, negated: bool, low: Box<ExprNode<'a>>, high: Box<ExprNode<'a>>, }, Like { expr: Box<ExprNode<'a>>, negated: bool, pattern: Box<ExprNode<'a>>, }, ILike { expr: Box<ExprNode<'a>>, negated: bool, pattern: Box<ExprNode<'a>>, }, BinaryOp { left: Box<ExprNode<'a>>, op: BinaryOperator, right: Box<ExprNode<'a>>, }, UnaryOp { op: UnaryOperator, expr: Box<ExprNode<'a>>, }, IsNull(Box<ExprNode<'a>>), IsNotNull(Box<ExprNode<'a>>), InList { expr: Box<ExprNode<'a>>, list: Box<InListNode<'a>>, negated: bool, }, Nested(Box<ExprNode<'a>>), Function(Box<FunctionNode<'a>>), Aggregate(Box<AggregateNode<'a>>), Exists { subquery: Box<QueryNode<'a>>, negated: bool, }, Subquery(Box<QueryNode<'a>>), Case { operand: Option<Box<ExprNode<'a>>>, when_then: Vec<(ExprNode<'a>, ExprNode<'a>)>, else_result: Option<Box<ExprNode<'a>>>, },
}
Expand description

Available expression builder functions

Variants§

§

Expr(Cow<'a, Expr>)

§

SqlExpr(Cow<'a, str>)

§

Identifier(Cow<'a, str>)

§

Numeric(NumericNode<'a>)

§

QuotedString(Cow<'a, str>)

§

TypedString

Fields

§data_type: DataType
§value: Cow<'a, str>
§

Between

Fields

§expr: Box<ExprNode<'a>>
§negated: bool
§low: Box<ExprNode<'a>>
§high: Box<ExprNode<'a>>
§

Like

Fields

§expr: Box<ExprNode<'a>>
§negated: bool
§pattern: Box<ExprNode<'a>>
§

ILike

Fields

§expr: Box<ExprNode<'a>>
§negated: bool
§pattern: Box<ExprNode<'a>>
§

BinaryOp

Fields

§left: Box<ExprNode<'a>>
§right: Box<ExprNode<'a>>
§

UnaryOp

Fields

§expr: Box<ExprNode<'a>>
§

IsNull(Box<ExprNode<'a>>)

§

IsNotNull(Box<ExprNode<'a>>)

§

InList

Fields

§expr: Box<ExprNode<'a>>
§list: Box<InListNode<'a>>
§negated: bool
§

Nested(Box<ExprNode<'a>>)

§

Function(Box<FunctionNode<'a>>)

§

Aggregate(Box<AggregateNode<'a>>)

§

Exists

Fields

§subquery: Box<QueryNode<'a>>
§negated: bool
§

Subquery(Box<QueryNode<'a>>)

§

Case

Fields

§operand: Option<Box<ExprNode<'a>>>
§when_then: Vec<(ExprNode<'a>, ExprNode<'a>)>
§else_result: Option<Box<ExprNode<'a>>>

Implementations§

Source§

impl<'a> ExprNode<'a>

Source

pub fn add<T: Into<Self>>(self, other: T) -> Self

Source

pub fn sub<T: Into<Self>>(self, other: T) -> Self

Source

pub fn mul<T: Into<Self>>(self, other: T) -> Self

Source

pub fn div<T: Into<Self>>(self, other: T) -> Self

Source

pub fn modulo<T: Into<Self>>(self, other: T) -> Self

Source

pub fn concat<T: Into<Self>>(self, other: T) -> Self

Source

pub fn gt<T: Into<Self>>(self, other: T) -> Self

Source

pub fn lt<T: Into<Self>>(self, other: T) -> Self

Source

pub fn gte<T: Into<Self>>(self, other: T) -> Self

Source

pub fn lte<T: Into<Self>>(self, other: T) -> Self

Source

pub fn eq<T: Into<Self>>(self, other: T) -> Self

Source

pub fn neq<T: Into<Self>>(self, other: T) -> Self

Source

pub fn and<T: Into<Self>>(self, other: T) -> Self

Source

pub fn or<T: Into<Self>>(self, other: T) -> Self

Source

pub fn bitwise_and<T: Into<Self>>(self, other: T) -> Self

Source

pub fn bitwise_shift_left<T: Into<Self>>(self, other: T) -> Self

Source

pub fn bitwise_shift_right<T: Into<Self>>(self, other: T) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn case(self) -> CaseNode<'a>

Source§

impl<'a> ExprNode<'a>

Source

pub fn is_null(self) -> Self

Source

pub fn is_not_null(self) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn like<T: Into<Self>>(self, pattern: T) -> Self

Source

pub fn ilike<T: Into<Self>>(self, pattern: T) -> Self

Source

pub fn not_like<T: Into<Self>>(self, pattern: T) -> Self

Source

pub fn not_ilike<T: Into<Self>>(self, pattern: T) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn nested(self) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn plus(self) -> Self

Source

pub fn minus(self) -> Self

Source

pub fn negate(self) -> Self

Source

pub fn factorial(self) -> Self

Source

pub fn bitwise_not(self) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn count(self) -> ExprNode<'a>

Source

pub fn count_distinct(self) -> ExprNode<'a>

Source

pub fn sum(self) -> ExprNode<'a>

Source

pub fn sum_distinct(self) -> ExprNode<'a>

Source

pub fn min(self) -> ExprNode<'a>

Source

pub fn min_distinct(self) -> ExprNode<'a>

Source

pub fn max(self) -> ExprNode<'a>

Source

pub fn max_distinct(self) -> ExprNode<'a>

Source

pub fn avg(self) -> ExprNode<'a>

Source

pub fn avg_distinct(self) -> ExprNode<'a>

Source

pub fn variance(self) -> ExprNode<'a>

Source

pub fn variance_distinct(self) -> ExprNode<'a>

Source

pub fn stdev(self) -> ExprNode<'a>

Source

pub fn stdev_distinct(self) -> ExprNode<'a>

Source§

impl<'a> ExprNode<'a>

Source

pub fn alias_as(self, alias: &str) -> ExprWithAliasNode<'a>

Source§

impl<'a> ExprNode<'a>

Source

pub fn between<T: Into<Self>, U: Into<Self>>(self, low: T, high: U) -> Self

Source

pub fn not_between<T: Into<Self>, U: Into<Self>>(self, low: T, high: U) -> Self

Source§

impl<'a> ExprNode<'a>

Source

pub fn abs(self) -> ExprNode<'a>

Source

pub fn upper(self) -> ExprNode<'a>

Source

pub fn lower(self) -> ExprNode<'a>

Source

pub fn initcap(self) -> ExprNode<'a>

Source

pub fn ifnull<T: Into<ExprNode<'a>>>(self, another: T) -> ExprNode<'a>

Source

pub fn nullif<T: Into<ExprNode<'a>>>(self, another: T) -> ExprNode<'a>

Source

pub fn ceil(self) -> ExprNode<'a>

Source

pub fn rand(self) -> ExprNode<'a>

Source

pub fn round(self) -> ExprNode<'a>

Source

pub fn trunc(self) -> ExprNode<'a>

Source

pub fn floor(self) -> ExprNode<'a>

Source

pub fn asin(self) -> ExprNode<'a>

Source

pub fn acos(self) -> ExprNode<'a>

Source

pub fn atan(self) -> ExprNode<'a>

Source

pub fn sin(self) -> ExprNode<'a>

Source

pub fn cos(self) -> ExprNode<'a>

Source

pub fn tan(self) -> ExprNode<'a>

Source

pub fn left<T: Into<ExprNode<'a>>>(self, size: T) -> Self

Source

pub fn log<T: Into<ExprNode<'a>>>(self, base: T) -> ExprNode<'a>

Source

pub fn log2(self) -> ExprNode<'a>

Source

pub fn log10(self) -> ExprNode<'a>

Source

pub fn ln(self) -> ExprNode<'a>

Source

pub fn right<T: Into<ExprNode<'a>>>(self, size: T) -> Self

Source

pub fn reverse(self) -> ExprNode<'a>

Source

pub fn sign(self) -> ExprNode<'a>

Source

pub fn skip<T: Into<ExprNode<'a>>>(self, size: T) -> ExprNode<'a>

Source

pub fn power<T: Into<ExprNode<'a>>>(self, pwr: T) -> ExprNode<'a>

Source

pub fn sqrt(self) -> ExprNode<'a>

Source

pub fn gcd<T: Into<ExprNode<'a>>>(self, right: T) -> ExprNode<'a>

Source

pub fn lcm<T: Into<ExprNode<'a>>>(self, right: T) -> ExprNode<'a>

Source

pub fn repeat<T: Into<ExprNode<'a>>>(self, num: T) -> ExprNode<'a>

Source

pub fn replace<T: Into<ExprNode<'a>>, U: Into<ExprNode<'a>>>( self, old: T, new: U, ) -> ExprNode<'a>

Source

pub fn degrees(self) -> ExprNode<'a>

Source

pub fn radians(self) -> ExprNode<'a>

Source

pub fn lpad<T: Into<ExprNode<'a>>>( self, size: T, fill: Option<ExprNode<'a>>, ) -> ExprNode<'a>

Source

pub fn rpad<T: Into<ExprNode<'a>>>( self, size: T, fill: Option<ExprNode<'a>>, ) -> ExprNode<'a>

Source

pub fn take<T: Into<ExprNode<'a>>>(self, size: T) -> ExprNode<'a>

Source

pub fn exp(self) -> ExprNode<'a>

Source

pub fn substr<T: Into<ExprNode<'a>>>( self, start: T, count: Option<ExprNode<'a>>, ) -> ExprNode<'a>

Source

pub fn rtrim(self, chars: Option<ExprNode<'a>>) -> ExprNode<'a>

Source

pub fn ltrim(self, chars: Option<ExprNode<'a>>) -> ExprNode<'a>

Source

pub fn format<T: Into<ExprNode<'a>>>(self, fmt: T) -> ExprNode<'a>

Source

pub fn to_date<T: Into<ExprNode<'a>>>(self, format: T) -> ExprNode<'a>

Source

pub fn to_timestamp<T: Into<ExprNode<'a>>>(self, format: T) -> ExprNode<'a>

Source

pub fn to_time<T: Into<ExprNode<'a>>>(self, format: T) -> ExprNode<'a>

Source

pub fn position<T: Into<ExprNode<'a>>>(self, format: T) -> ExprNode<'a>

Source

pub fn find_idx<T: Into<ExprNode<'a>>>( self, sub: T, start: Option<ExprNode<'a>>, ) -> ExprNode<'a>

Source

pub fn cast<T: Into<DataTypeNode>>(self, data_type: T) -> ExprNode<'a>

Source

pub fn extract(self, field: DateTimeField) -> ExprNode<'a>

Source

pub fn is_empty(self) -> ExprNode<'a>

Source

pub fn last_day(self) -> ExprNode<'a>

Source

pub fn entries(self) -> ExprNode<'a>

Source

pub fn keys(self) -> ExprNode<'a>

Source

pub fn values(self) -> ExprNode<'a>

Source§

impl<'a> ExprNode<'a>

Source

pub fn in_list<T: Into<InListNode<'a>>>(self, value: T) -> Self

Source

pub fn not_in_list<T: Into<InListNode<'a>>>(self, value: T) -> Self

Trait Implementations§

Source§

impl<'a> Clone for ExprNode<'a>

Source§

fn clone(&self) -> ExprNode<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ExprNode<'a>

Source§

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

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

impl<'a> From<&'a Expr> for ExprNode<'a>

Source§

fn from(expr: &'a Expr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for ExprNode<'a>

Source§

fn from(expr: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Expr> for ExprNode<'a>

Source§

fn from(expr: Expr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ExprNode<'a>> for OrderByExprList<'a>

Source§

fn from(expr_node: ExprNode<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ExprNode<'a>> for OrderByExprNode<'a>

Source§

fn from(expr_node: ExprNode<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ExprNode<'a>> for SelectItemList<'a>

Source§

fn from(expr_node: ExprNode<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ExprNode<'a>> for SelectItemNode<'a>

Source§

fn from(expr_node: ExprNode<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<QueryNode<'a>> for ExprNode<'a>

Source§

fn from(node: QueryNode<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<String> for ExprNode<'a>

Source§

fn from(expr: String) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<bool> for ExprNode<'a>

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<i64> for ExprNode<'a>

Source§

fn from(n: i64) -> Self

Converts to this type from the input type.
Source§

impl<'a> TryFrom<ExprNode<'a>> for Expr

Source§

type Error = Error

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

fn try_from(expr_node: ExprNode<'a>) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for ExprNode<'a>

§

impl<'a> RefUnwindSafe for ExprNode<'a>

§

impl<'a> Send for ExprNode<'a>

§

impl<'a> Sync for ExprNode<'a>

§

impl<'a> Unpin for ExprNode<'a>

§

impl<'a> UnwindSafe for ExprNode<'a>

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

Source§

type Output = T

Should always be Self
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 = 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V