Skip to main content

Column

Struct Column 

Source
pub struct Column<C: ColumnKey>(/* private fields */);
Expand description

A column reference, identified entirely by its ColumnKey. Generated per-field by #[derive(Table)] as a pub const NAME: Column<..> inside each table’s module (e.g. users::id). A plain, Copy value — not tied to any particular query — which is what lets it be reused across queries and passed as an ordinary function argument instead of through a scope-bound cursor closure.

Implementations§

Source§

impl<C: ColumnKey> Column<C>

Source

pub const fn new() -> Self

Trait Implementations§

Source§

impl<C: ColumnKey> Clone for Column<C>

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<C: ColumnKey> ConflictTarget<<C as ColumnKey>::Table> for Column<C>

Source§

impl<C: ColumnKey> Copy for Column<C>

Source§

impl<C: ColumnKey> Default for Column<C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<C: ColumnKey> IntoExpr for Column<C>

Source§

type Sql = <C as ColumnKey>::Sql

The SQL type this expression has. An associated type rather than a parameter because every implementor has exactly one — a column its declared type, a literal its leaf type — which is what lets a mismatch report itself as Comparable/AssignsTo rather than as an inference failure on a type nobody wrote.
Source§

type Req = Cons<<C as ColumnKey>::Table, Nil>

Source§

fn into_expr(self) -> Expr<Self::Req, C::Sql>

Source§

impl<C: ColumnKey> LabelExt for Column<C>

Source§

fn label<K: LabelKey>(self, _key: K) -> Labeled<K, Self>

Source§

impl<C: ColumnKey> LookupKey for Column<C>

Source§

impl<C: ColumnKey> Not for Column<C>
where C::Sql: BoolLike,

Source§

type Output = Expr<Cons<<C as ColumnKey>::Table, Nil>, <C as ColumnKey>::Sql>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<C: ColumnKey, Scope, Idx> RowField<Scope, Idx> for Column<C>
where Scope: Find<C::Table, Idx>, C::Sql: WrapNullable<<Scope as Find<C::Table, Idx>>::Nullability>, <C::Sql as WrapNullable<<Scope as Find<C::Table, Idx>>::Nullability>>::Output: SqlType,

Source§

type Value = <<<C as ColumnKey>::Sql as WrapNullable<<Scope as Find<<C as ColumnKey>::Table, Idx>>::Nullability>>::Output as SqlType>::Native

Source§

fn item(&self) -> SelectItem

Source§

impl<C: ColumnKey> RowKey for Column<C>

Source§

type Key = C

Source§

impl<C: ColumnKey, Scope, Idx> Selection<Scope, Idx> for Column<C>
where Column<C>: RowField<Scope, Idx>,

Source§

type Output = <Column<C> as RowField<Scope, Idx>>::Value

Source§

fn items(&self) -> Vec<SelectItem>

Source§

impl<C: ColumnKey, Scope, Idx> SelectionPart<Scope, Idx> for Column<C>
where Column<C>: RowField<Scope, Idx>,

Source§

type Fields<Tail> = RowCons<<Column<C> as RowKey>::Key, <Column<C> as RowField<Scope, Idx>>::Value, Tail>

Source§

fn push_items(&self, out: &mut Vec<SelectItem>)

Auto Trait Implementations§

§

impl<C> Freeze for Column<C>
where PhantomData<C>: Freeze,

§

impl<C> RefUnwindSafe for Column<C>

§

impl<C> Send for Column<C>
where PhantomData<C>: Send,

§

impl<C> Sync for Column<C>
where PhantomData<C>: Sync,

§

impl<C> Unpin for Column<C>
where PhantomData<C>: Unpin,

§

impl<C> UnsafeUnpin for Column<C>

§

impl<C> UnwindSafe for Column<C>

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<D, Scope, Req, Idxs, T> Condition<D, Scope, Idxs> for T
where Scope: Superset<Req, Idxs>, T: IntoExpr<Req = Req>, <T as IntoExpr>::Sql: BoolLike,

Source§

fn into_predicate(self) -> Predicate<D, Scope>

Source§

impl<T> ExprMethods for T
where T: IntoExpr,

Source§

fn eq<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn ne<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn lt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn lte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn gt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn gte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: Comparable<Rhs::Sql>, Self::Req: Concat<Rhs::Req>,

Source§

fn is_null(self) -> Expr<Self::Req, Bool>

x IS NULL. Not expressible as .eq(..): comparing to NULL with = yields NULL, never true, so the two are different questions.
Source§

fn is_not_null(self) -> Expr<Self::Req, Bool>

Source§

fn and<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: BoolLike, Rhs::Sql: BoolLike, Self::Req: Concat<Rhs::Req>,

a AND b. The boolean requirement is on the method rather than on the receiver’s type, so every spelling a condition has — a comparison, a sql! fragment, a Nullable<Bool> column — combines with every other, the way .filter accepts them all.
Source§

fn or<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: BoolLike, Rhs::Sql: BoolLike, Self::Req: Concat<Rhs::Req>,

a OR b — see and.
Source§

fn like<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: TextLike, Rhs::Sql: TextLike, Self::Req: Concat<Rhs::Req>,

x LIKE 'pattern'. The text requirement is on the method rather than on a trait of its own, so a non-text operand reports TextLike instead of a missing method.
Source§

fn is_in<I>(self, values: I) -> Expr<Self::Req, Bool>
where I: IntoIterator, I::Item: IntoExpr<Req = Nil>, Self::Sql: Comparable<<I::Item as IntoExpr>::Sql>,

x IN (a, b, ..) over a runtime-length list of literals, each bound as its own parameter. An empty list renders FALSE. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Scope, Req, Idxs, T> GroupBy<Scope, Idxs> for T
where Scope: Superset<Req, Idxs>, T: IntoExpr<Req = Req>,

Source§

fn into_grouping(self) -> Grouping<Scope>

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> OrderExt for T
where T: IntoExpr,

Source§

fn asc(self) -> OrderKey<Self::Req>

Source§

fn sort(self, dir: SortDir) -> OrderKey<Self::Req>

The direction as a value, for a sort order that arrives at runtime — ?dir=desc — instead of an N-way match over .asc()/.desc().
Source§

fn desc(self) -> OrderKey<Self::Req>

Source§

impl<T> RawArg for T
where T: IntoExpr,

Source§

impl<S> Superset<Nil, Nil> for S

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

impl<T> WrapNullable<NotNull> for T