pub struct ColumnDef {
pub name: String,
pub col_type: ColumnType,
pub nullable: bool,
pub default: Option<Value>,
pub primary_key: bool,
pub auto_increment: bool,
pub unique: bool,
pub index: bool,
}Expand description
A column definition in the lightweight schema DSL.
Fields§
§name: StringThe column name.
col_type: ColumnTypeThe logical column type.
nullable: boolWhether the column accepts NULL values.
default: Option<Value>The default value when one is configured.
primary_key: boolWhether this column is the primary key.
auto_increment: boolWhether the column auto-increments.
unique: boolWhether the column is unique.
index: boolWhether the column should be indexed.
Implementations§
Source§impl ColumnDef
impl ColumnDef
Sourcepub fn new(name: &str, col_type: ColumnType) -> Self
pub fn new(name: &str, col_type: ColumnType) -> Self
Creates a new column definition with sensible defaults.
Sourcepub fn primary_key(self) -> Self
pub fn primary_key(self) -> Self
Marks the column as the primary key.
Sourcepub fn auto_increment(self) -> Self
pub fn auto_increment(self) -> Self
Marks the column as auto-incrementing.
Trait Implementations§
impl StructuralPartialEq for ColumnDef
Auto Trait Implementations§
impl Freeze for ColumnDef
impl RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin for ColumnDef
impl UnsafeUnpin 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: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more