pub struct TableField {
pub name: &'static str,
pub data_type: String,
pub is_unique: bool,
pub is_not_null: bool,
pub default: Option<String>,
pub is_auto_increment: bool,
}Expand description
Column definition used by drivers to build tables and migrations.
This struct is used when calling Driver::create_table and
within AlterTableSingle::AddColumn. Driver backends
map the fields to SQL column definitions appropriate for their dialect.
Fields§
§name: &'static strColumn name as it should appear in SQL.
data_type: StringDatabase-specific type name (e.g. TEXT, INTEGER, UUID).
is_unique: boolWhether to add a UNIQUE constraint.
is_not_null: boolWhether to add a NOT NULL constraint.
default: Option<String>Optional SQL literal used as DEFAULT value.
is_auto_increment: boolWhether the column should auto-increment (driver-specific behavior).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TableField
impl RefUnwindSafe for TableField
impl Send for TableField
impl Sync for TableField
impl Unpin for TableField
impl UnwindSafe for TableField
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> 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