pub struct Column { /* private fields */ }Expand description
A column to add, described portably (the dialect-specific type rendering
is deferred to apply time, exactly as crate::schema does for CREATE).
New columns default to nullable: adding a NOT NULL column to a table
that already has rows fails unless a default backfills them, so call
not_null together with default.
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(name: impl Into<String>, ty: ColumnType) -> Self
pub fn new(name: impl Into<String>, ty: ColumnType) -> Self
A nullable column of ty.
Sourcepub fn not_null(self) -> Self
pub fn not_null(self) -> Self
Mark the column NOT NULL. Pair with default when the
table may already hold rows.
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
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