Skip to main content

ColumnTrait

Trait ColumnTrait 

Source
pub trait ColumnTrait: IdenStatic + Iterable {
    const TABLE: &'static str;
Show 30 methods // Required method fn def(&self) -> ColumnDef; // Provided methods fn as_column_ref(&self) -> ColumnRef { ... } fn into_expr(self) -> Expr { ... } fn eq<V: Into<Value>>(&self, v: V) -> Expr { ... } fn ne<V: Into<Value>>(&self, v: V) -> Expr { ... } fn gt<V: Into<Value>>(&self, v: V) -> Expr { ... } fn gte<V: Into<Value>>(&self, v: V) -> Expr { ... } fn lt<V: Into<Value>>(&self, v: V) -> Expr { ... } fn lte<V: Into<Value>>(&self, v: V) -> Expr { ... } fn between<V: Into<Value>>(&self, a: V, b: V) -> Expr { ... } fn not_between<V: Into<Value>>(&self, a: V, b: V) -> Expr { ... } fn like(&self, pattern: &str) -> Expr { ... } fn not_like(&self, pattern: &str) -> Expr { ... } fn starts_with(&self, s: &str) -> Expr { ... } fn ends_with(&self, s: &str) -> Expr { ... } fn contains(&self, s: &str) -> Expr { ... } fn is_null(&self) -> Expr { ... } fn is_not_null(&self) -> Expr { ... } fn is_in<V: Into<Value>, I: IntoIterator<Item = V>>( &self, values: I, ) -> Expr { ... } fn is_not_in<V: Into<Value>, I: IntoIterator<Item = V>>( &self, values: I, ) -> Expr { ... } fn in_subquery(&self, select: Select) -> Expr { ... } fn not_in_subquery(&self, select: Select) -> Expr { ... } fn eq_col<C: ColumnTrait>(&self, other: C) -> Expr { ... } fn matches(&self, query: &str) -> Expr { ... } fn if_null<V: Into<Value>>(&self, v: V) -> Expr { ... } fn max(&self) -> Expr { ... } fn min(&self) -> Expr { ... } fn sum(&self) -> Expr { ... } fn count(&self) -> Expr { ... } fn avg(&self) -> Expr { ... }
}
Expand description

A column of an entity, derived on the Column enum.

Provides the condition builders: Column::Name.eq("x"), Column::Age.gt(18) and so on. Every builder renders the column as table.column, so conditions stay unambiguous after a join.

Required Associated Constants§

Source

const TABLE: &'static str

The table this column belongs to.

Required Methods§

Source

fn def(&self) -> ColumnDef

The static definition used for schema generation.

Provided Methods§

Source

fn as_column_ref(&self) -> ColumnRef

The column as a qualified table.column reference.

Source

fn into_expr(self) -> Expr

The column as an expression.

Source

fn eq<V: Into<Value>>(&self, v: V) -> Expr

Builds col = v.

Source

fn ne<V: Into<Value>>(&self, v: V) -> Expr

Builds col <> v.

Source

fn gt<V: Into<Value>>(&self, v: V) -> Expr

Builds col > v.

Source

fn gte<V: Into<Value>>(&self, v: V) -> Expr

Builds col >= v.

Source

fn lt<V: Into<Value>>(&self, v: V) -> Expr

Builds col < v.

Source

fn lte<V: Into<Value>>(&self, v: V) -> Expr

Builds col <= v.

Source

fn between<V: Into<Value>>(&self, a: V, b: V) -> Expr

Builds col BETWEEN a AND b.

Source

fn not_between<V: Into<Value>>(&self, a: V, b: V) -> Expr

Builds col NOT BETWEEN a AND b.

Source

fn like(&self, pattern: &str) -> Expr

Builds col LIKE pattern.

Source

fn not_like(&self, pattern: &str) -> Expr

Builds col NOT LIKE pattern.

Source

fn starts_with(&self, s: &str) -> Expr

Builds col LIKE 's%'.

Source

fn ends_with(&self, s: &str) -> Expr

Builds col LIKE '%s'.

Source

fn contains(&self, s: &str) -> Expr

Builds col LIKE '%s%'.

Source

fn is_null(&self) -> Expr

Builds col IS NULL.

Source

fn is_not_null(&self) -> Expr

Builds col IS NOT NULL.

Source

fn is_in<V: Into<Value>, I: IntoIterator<Item = V>>(&self, values: I) -> Expr

Builds col IN (values).

Source

fn is_not_in<V: Into<Value>, I: IntoIterator<Item = V>>( &self, values: I, ) -> Expr

Builds col NOT IN (values).

Source

fn in_subquery(&self, select: Select) -> Expr

Builds col IN (subquery).

Source

fn not_in_subquery(&self, select: Select) -> Expr

Builds col NOT IN (subquery).

Source

fn eq_col<C: ColumnTrait>(&self, other: C) -> Expr

Builds col = other.col, comparing two columns rather than a column and a value, for example across a join.

Source

fn matches(&self, query: &str) -> Expr

Builds col MATCH query for full-text search.

Source

fn if_null<V: Into<Value>>(&self, v: V) -> Expr

Builds IFNULL(col, v).

Source

fn max(&self) -> Expr

Builds MAX(col).

Source

fn min(&self) -> Expr

Builds MIN(col).

Source

fn sum(&self) -> Expr

Builds SUM(col).

Source

fn count(&self) -> Expr

Builds COUNT(col).

Source

fn avg(&self) -> Expr

Builds AVG(col).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§