pub struct ColumnDef {
pub name: String,
pub col_type: ColumnType,
pub nullable: bool,
pub primary_key: bool,
pub unique: bool,
pub default: Option<String>,
pub foreign_key: Option<ForeignKey>,
}Expand description
Definition of a single column.
Fields§
§name: String§col_type: ColumnType§nullable: bool§primary_key: bool§unique: bool§default: Option<String>§foreign_key: Option<ForeignKey>Implementations§
Source§impl ColumnDef
impl ColumnDef
Sourcepub fn new(name: &str, col_type: ColumnType) -> Self
pub fn new(name: &str, col_type: ColumnType) -> Self
Create a new non-null column with no constraints.
pub fn nullable(self) -> Self
pub fn primary_key(self) -> Self
pub fn unique(self) -> Self
pub fn default(self, val: &str) -> Self
pub fn references(self, table: &str, column: &str, on_delete: OnDelete) -> Self
Trait Implementations§
impl Eq for ColumnDef
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.