Skip to main content

SQLColumn

Trait SQLColumn 

Source
pub trait SQLColumn<'a, Value: SQLParam + 'a>:
    SQLColumnInfo
    + Default
    + SQLSchema<'a, &'a str, Value>
    + Expr<'a, Value> {
    type Table: SQLTable<'a, Self::TableType, Value>;
    type TableType: SQLSchemaType;
    type ForeignKeys;
    type Type: TryInto<Value>;

    const PRIMARY_KEY: bool = false;
    const NOT_NULL: bool = false;
    const UNIQUE: bool = false;
    const DEFAULT: Option<Self::Type> = None;

    // Provided methods
    fn default_fn(&'a self) -> Option<impl Fn() -> Self::Type> { ... }
    fn placeholder(
        &self,
        name: &'static str,
    ) -> TypedPlaceholder<<Self as Expr<'a, Value>>::SQLType, <Self as Expr<'a, Value>>::Nullable>
       where Self: Sized { ... }
}
Expand description

Column trait tying expression lifetimes to parameter values via 'a.

Provided Associated Constants§

Source

const PRIMARY_KEY: bool = false

Source

const NOT_NULL: bool = false

Source

const UNIQUE: bool = false

Source

const DEFAULT: Option<Self::Type> = None

Required Associated Types§

Provided Methods§

Source

fn default_fn(&'a self) -> Option<impl Fn() -> Self::Type>

Source

fn placeholder( &self, name: &'static str, ) -> TypedPlaceholder<<Self as Expr<'a, Value>>::SQLType, <Self as Expr<'a, Value>>::Nullable>
where Self: Sized,

Creates a typed named placeholder for this column’s SQL type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a, Value, T> SQLColumn<'a, Value> for &T
where Value: SQLParam + 'a, T: SQLColumn<'a, Value>, for<'r> &'r T: SQLColumnInfo + Default + SQLSchema<'a, &'a str, Value> + Expr<'a, Value>,

Source§

const PRIMARY_KEY: bool = T::PRIMARY_KEY

Source§

const NOT_NULL: bool = T::NOT_NULL

Source§

const UNIQUE: bool = T::UNIQUE

Source§

const DEFAULT: Option<Self::Type> = T::DEFAULT

Source§

type Table = <T as SQLColumn<'a, Value>>::Table

Source§

type TableType = <T as SQLColumn<'a, Value>>::TableType

Source§

type ForeignKeys = <T as SQLColumn<'a, Value>>::ForeignKeys

Source§

type Type = <T as SQLColumn<'a, Value>>::Type

Source§

fn default_fn(&'a self) -> Option<impl Fn() -> Self::Type>

Implementors§