[][src]Trait ergol::ToTable

pub trait ToTable: Send + Debug {
    pub fn from_row(row: Row) -> Self;
pub fn table_name() -> &'static str;
pub fn id_name() -> &'static str;
pub fn id(&self) -> i32;
pub fn create_table() -> CreateTable;
pub fn drop_table() -> DropTable;
pub fn select() -> Select<Self>; }

Any type that should be transformed into a table should implement this trait.

You should not implement this trait yourself, and use the #ergol macro to implement this trait for your structs.

Required methods

pub fn from_row(row: Row) -> Self[src]

Converts a row of a table into an object.

pub fn table_name() -> &'static str[src]

Returns the name of the table corresponding to Self.

pub fn id_name() -> &'static str[src]

Returns the name of the primary key of the table corresponding to Self.

pub fn id(&self) -> i32[src]

Returns the id of self.

pub fn create_table() -> CreateTable[src]

Returns the query that creates the table.

pub fn drop_table() -> DropTable[src]

Returns the query that drops the table.

pub fn select() -> Select<Self>[src]

Returns a select query.

Loading content...

Implementors

Loading content...