pub struct ColumnDef {
pub name: String,
pub sql_type: SqlType,
pub nullable: bool,
pub primary_key: bool,
pub auto_increment: bool,
pub default: Option<String>,
}Expand description
A column definition for dynamic models.
Fields§
§name: StringColumn name in the database.
sql_type: SqlTypeSQL type.
nullable: boolWhether this column is nullable.
primary_key: boolWhether this is a primary key column.
auto_increment: boolWhether this is auto-incrementing.
default: Option<String>Default value expression.
Implementations§
Source§impl ColumnDef
impl ColumnDef
Sourcepub fn primary_key(self) -> Self
pub fn primary_key(self) -> Self
Mark as primary key.
Sourcepub fn auto_increment(self) -> Self
pub fn auto_increment(self) -> Self
Mark as auto-incrementing.
Sourcepub fn with_default(self, default: impl Into<String>) -> Self
pub fn with_default(self, default: impl Into<String>) -> Self
Set default value expression.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColumnDef
impl RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin for ColumnDef
impl UnwindSafe for ColumnDef
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).