Struct barrel::table::Column [−][src]
pub struct Column { pub unique: bool, pub indexed: bool, pub nullable: bool, pub increments: bool, pub _type: Type, pub def: Option<ColumnDefault>, }
Fields
unique: bool
Is this a unique key
indexed: bool
Should the database create an index
nullable: bool
Can this column be NULL
increments: bool
Does it auto-increment
_type: Type
What's the column type
def: Option<ColumnDefault>
What's default value records in this column
Methods
impl Column
[src]
impl Column
pub fn new(t: Type) -> Column
[src]
pub fn new(t: Type) -> Column
Lazy constructor mostly used in unit tests
pub fn default<T: Into<ColumnDefault>>(&mut self, data: T) -> &mut Column
[src]
pub fn default<T: Into<ColumnDefault>>(&mut self, data: T) -> &mut Column
Set a default value for this column
pub fn nullable(&mut self) -> &mut Column
[src]
pub fn nullable(&mut self) -> &mut Column
Set a column to allow being null
pub fn increments(&mut self) -> &mut Column
[src]
pub fn increments(&mut self) -> &mut Column
Setup this column to automatically increment (such as integers)
Throws an error if the column type can't increment (like booleans)
Trait Implementations
impl Debug for Column
[src]
impl Debug for Column
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Column
[src]
impl Clone for Column