pub struct Expression<'a> { /* private fields */ }
Expand description

An expression that can be positioned in a query. Can be a single value or a statement that is evaluated into a value.

Implementations§

source§

impl<'a> Expression<'a>

source

pub fn kind(&self) -> &ExpressionKind<'a>

The type of the expression, dictates how it’s implemented in the query.

source

pub fn alias(&self) -> Option<&str>

The name alias of the expression, how it can referred in the query.

Trait Implementations§

source§

impl<'a> Add<Expression<'a>> for Expression<'a>

§

type Output = Expression<'a>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl<'a> Aliasable<'a> for Expression<'a>

§

type Target = Expression<'a>

source§

fn alias<T>(self, alias: T) -> Self::Targetwhere T: Into<Cow<'a, str>>,

Alias table for usage elsewhere in the query.
source§

impl<'a> Clone for Expression<'a>

source§

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

Returns a copy 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> Comparable<'a> for Expression<'a>

source§

fn equals<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if both sides are the same value.
source§

fn not_equals<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if both sides are not the same value.
source§

fn less_than<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is smaller than the right side.
source§

fn less_than_or_equals<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is smaller than the right side or the same.
source§

fn greater_than<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is bigger than the right side.
source§

fn greater_than_or_equals<T>(self, comparison: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is bigger than the right side or the same.
source§

fn in_selection<T>(self, selection: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is included in the right side collection.
source§

fn not_in_selection<T>(self, selection: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side is not included in the right side collection.
source§

fn like<T>(self, pattern: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side includes the right side string.
source§

fn not_like<T>(self, pattern: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the left side does not include the right side string.
source§

fn is_null(self) -> Compare<'a>

Tests if the left side is NULL.
source§

fn is_not_null(self) -> Compare<'a>

Tests if the left side is not NULL.
source§

fn between<T, V>(self, left: T, right: V) -> Compare<'a>where T: Into<Expression<'a>>, V: Into<Expression<'a>>,

Tests if the value is between two given values.
source§

fn not_between<T, V>(self, left: T, right: V) -> Compare<'a>where T: Into<Expression<'a>>, V: Into<Expression<'a>>,

Tests if the value is not between two given values.
source§

fn compare_raw<T, V>(self, raw_comparator: T, right: V) -> Compare<'a>where T: Into<Cow<'a, str>>, V: Into<Expression<'a>>,

Compares two expressions with a custom operator.
source§

fn json_array_contains<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array contains a value.
source§

fn json_array_not_contains<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array does not contain a value.
source§

fn json_array_begins_with<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array starts with a value.
source§

fn json_array_not_begins_with<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array does not start with a value.
source§

fn json_array_ends_into<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array ends with a value.
source§

fn json_array_not_ends_into<T>(self, item: T) -> Compare<'a>where T: Into<Expression<'a>>,

Tests if the JSON array does not end with a value.
source§

fn json_type_equals<T>(self, json_type: T) -> Compare<'a>where T: Into<JsonType<'a>>,

Tests if the JSON value is of a certain type.
source§

fn json_type_not_equals<T>(self, json_type: T) -> Compare<'a>where T: Into<JsonType<'a>>,

Tests if the JSON value is not of a certain type.
source§

fn any(self) -> Compare<'a>

Matches at least one elem of a list of values.
source§

fn all(self) -> Compare<'a>

Matches all elem of a list of values.
source§

impl<'a> Debug for Expression<'a>

source§

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

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

impl<'a> Div<Expression<'a>> for Expression<'a>

§

type Output = Expression<'a>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl<'a> From<Column<'a>> for Expression<'a>

source§

fn from(col: Column<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Compare<'a>> for Expression<'a>

source§

fn from(cmp: Compare<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ConditionTree<'a>> for Expression<'a>

source§

fn from(ct: ConditionTree<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ExpressionKind<'a>> for Expression<'a>

source§

fn from(kind: ExpressionKind<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Function<'a>> for Expression<'a>

source§

fn from(f: Function<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Row<'a>> for Expression<'a>

source§

fn from(value: Row<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Select<'a>> for Expression<'a>

source§

fn from(sel: Select<'a>) -> Expression<'a>

Converts to this type from the input type.
source§

impl<'a> From<SqlOp<'a>> for Expression<'a>

source§

fn from(p: SqlOp<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<T> for Expression<'a>where T: Into<Value>,

source§

fn from(p: T) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Table<'a>> for Expression<'a>

source§

fn from(value: Table<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Values<'a>> for Expression<'a>

source§

fn from(value: Values<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> Mul<Expression<'a>> for Expression<'a>

§

type Output = Expression<'a>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl<'a> PartialEq<Expression<'a>> for Expression<'a>

source§

fn eq(&self, other: &Expression<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Rem<Expression<'a>> for Expression<'a>

§

type Output = Expression<'a>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
source§

impl<'a> Sub<Expression<'a>> for Expression<'a>

§

type Output = Expression<'a>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<'a> StructuralPartialEq for Expression<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Expression<'a>

§

impl<'a> Send for Expression<'a>

§

impl<'a> Sync for Expression<'a>

§

impl<'a> Unpin for Expression<'a>

§

impl<'a> UnwindSafe for Expression<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<'a, T> Conjunctive<'a> for Twhere T: Into<Expression<'a>>,

source§

fn and<E>(self, other: E) -> ConditionTree<'a>where E: Into<Expression<'a>>,

Builds an AND condition having self as the left leaf and other as the right.
source§

fn or<E>(self, other: E) -> ConditionTree<'a>where E: Into<Expression<'a>>,

Builds an OR condition having self as the left leaf and other as the right.
source§

fn not(self) -> ConditionTree<'a>

Builds a NOT condition having self as the condition.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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

§

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

§

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.