pub struct TableBuilder { /* private fields */ }Expand description
Collects column definitions inside create_table.
A big-integer, auto-incrementing id primary key is added automatically,
matching Rails’ implicit primary key.
Implementations§
Source§impl TableBuilder
impl TableBuilder
Sourcepub fn column(&mut self, col: ColumnDef) -> &mut ColumnDef
pub fn column(&mut self, col: ColumnDef) -> &mut ColumnDef
Pushes a fully built column and returns it for further chaining
(e.g. .not_null(), .default(...), .unique_key()).
pub fn string(&mut self, name: &str) -> &mut ColumnDef
pub fn text(&mut self, name: &str) -> &mut ColumnDef
pub fn integer(&mut self, name: &str) -> &mut ColumnDef
pub fn big_integer(&mut self, name: &str) -> &mut ColumnDef
pub fn float(&mut self, name: &str) -> &mut ColumnDef
pub fn double(&mut self, name: &str) -> &mut ColumnDef
pub fn decimal(&mut self, name: &str) -> &mut ColumnDef
pub fn boolean(&mut self, name: &str) -> &mut ColumnDef
pub fn timestamp(&mut self, name: &str) -> &mut ColumnDef
pub fn date(&mut self, name: &str) -> &mut ColumnDef
pub fn json(&mut self, name: &str) -> &mut ColumnDef
pub fn uuid(&mut self, name: &str) -> &mut ColumnDef
pub fn binary(&mut self, name: &str) -> &mut ColumnDef
Sourcepub fn references(&mut self, name: &str) -> &mut ColumnDef
pub fn references(&mut self, name: &str) -> &mut ColumnDef
Rails t.references :user — adds a non-null <name>_id big-integer column.
Sourcepub fn timestamps(&mut self)
pub fn timestamps(&mut self)
Rails t.timestamps — adds non-null created_at and updated_at,
each defaulting to the current timestamp.
Auto Trait Implementations§
impl Freeze for TableBuilder
impl RefUnwindSafe for TableBuilder
impl Send for TableBuilder
impl Sync for TableBuilder
impl Unpin for TableBuilder
impl UnsafeUnpin for TableBuilder
impl UnwindSafe for TableBuilder
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