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
A table column for the dialect whose value type is Value.
Generated by the table macros for each column. A column is also a typed
expression (Expr), so it can be selected, compared and passed to SQL
functions.
Provided Associated Constants§
Sourceconst PRIMARY_KEY: bool = false
const PRIMARY_KEY: bool = false
Whether the column is part of the primary key.
Required Associated Types§
Sourcetype TableType: SQLSchemaType
type TableType: SQLSchemaType
The table’s dialect marker.
Sourcetype ForeignKeys
type ForeignKeys
The column’s foreign key reference, if any.
Provided Methods§
Sourcefn default_fn(&'a self) -> Option<impl Fn() -> Self::Type>
fn default_fn(&'a self) -> Option<impl Fn() -> Self::Type>
The function that computes the column’s default on insert, if any
(#[column(default_fn = ...)]).
Sourcefn placeholder(
&self,
name: &'static str,
) -> TypedPlaceholder<<Self as Expr<'a, Value>>::SQLType, <Self as Expr<'a, Value>>::Nullable>where
Self: Sized,
fn placeholder(
&self,
name: &'static str,
) -> TypedPlaceholder<<Self as Expr<'a, Value>>::SQLType, <Self as Expr<'a, Value>>::Nullable>where
Self: Sized,
Creates a named placeholder with this column’s SQL type and nullability, for use in prepared statements.
The placeholder only binds values the column could hold. See
TypedPlaceholder.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".