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§
Trait Implementations§
impl<C: ColumnKey> ConflictTarget<<C as ColumnKey>::Table> for Column<C>
impl<C: ColumnKey> Copy for Column<C>
Source§impl<C: ColumnKey> IntoExpr for Column<C>
impl<C: ColumnKey> IntoExpr for Column<C>
Source§type Sql = <C as ColumnKey>::Sql
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.type Req = Cons<<C as ColumnKey>::Table, Nil>
fn into_expr(self) -> Expr<Self::Req, C::Sql>
impl<C: ColumnKey> LookupKey for Column<C>
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,
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,
Auto Trait Implementations§
impl<C> Freeze for Column<C>where
PhantomData<C>: Freeze,
impl<C> RefUnwindSafe for Column<C>where
PhantomData<C>: RefUnwindSafe,
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>where
PhantomData<C>: UnsafeUnpin,
impl<C> UnwindSafe for Column<C>where
PhantomData<C>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D, Scope, Req, Idxs, T> Condition<D, Scope, Idxs> for T
impl<D, Scope, Req, Idxs, T> Condition<D, Scope, Idxs> for T
fn into_predicate(self) -> Predicate<D, Scope>
Source§impl<T> ExprMethods for Twhere
T: IntoExpr,
impl<T> ExprMethods for Twhere
T: IntoExpr,
fn eq<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn ne<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn lt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn lte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn gt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn gte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
Source§fn is_null(self) -> Expr<Self::Req, Bool>
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.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>
fn and<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
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>
fn or<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
a OR b — see and.