Trait ergol::ToTable [−][src]
pub trait ToTable: Send + Debug + Sized { fn from_row_with_offset(row: &Row, offset: usize) -> Self; fn table_name() -> &'static str; fn id_name() -> &'static str; fn id(&self) -> i32; fn create_table() -> CreateTable; fn drop_table() -> DropTable; fn select() -> Select<Self>; fn from_row(row: &Row) -> Self { ... } }
Expand description
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
fn from_row_with_offset(row: &Row, offset: usize) -> Self
[src]
fn from_row_with_offset(row: &Row, offset: usize) -> Self
[src]Converts a row of a table into an object.
fn table_name() -> &'static str
[src]
fn table_name() -> &'static str
[src]Returns the name of the table corresponding to Self.
Returns the name of the primary key of the table corresponding to Self.
fn create_table() -> CreateTable
[src]
fn create_table() -> CreateTable
[src]Returns the query that creates the table.
fn drop_table() -> DropTable
[src]
fn drop_table() -> DropTable
[src]Returns the query that drops the table.