[][src]Struct barrel::table::Table

pub struct Table {
    pub meta: TableMeta,
    // some fields omitted
}

Fields

meta: TableMeta

Methods

impl Table[src]

pub fn new<S: Into<String>>(name: S) -> Self[src]

pub fn add_column<S: Into<String>>(&mut self, name: S, _type: Type) -> &mut Type[src]

Add a new column to a table

table.add_column("id", types::primary());
table.add_column("name", types::varchar(64));

pub fn drop_column<S: Into<String>>(&mut self, name: S)[src]

pub fn rename_column<S: Into<String>>(&mut self, old: S, new: S)[src]

pub fn inject_custom<S: Into<String>>(&mut self, sql: S)[src]

pub fn add_index<S: Into<String>>(&mut self, name: S, columns: Type)[src]

Add a new index to a table, spanning over multiple columns

pub fn drop_index<S: Into<String>>(&mut self, name: S)[src]

Drop an index on this table

pub fn make<T: SqlGenerator>(
    &mut self,
    ex: bool,
    schema: Option<&str>
) -> (Vec<String>, Vec<String>)
[src]

Generate Sql for this table, returned as two vectors

The first vector (.0) represents all column changes done to the table, the second vector (.1) contains all index and suffix changes.

It is very well possible for either of them to be empty, although both being empty might signify an error.

Trait Implementations

impl Clone for Table[src]

impl Debug for Table[src]

Auto Trait Implementations

impl !RefUnwindSafe for Table

impl !Send for Table

impl !Sync for Table

impl Unpin for Table

impl !UnwindSafe for Table

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.