[][src]Trait elephantry::Entity

pub trait Entity {
    pub fn from(tuple: &Tuple<'_>) -> Self;
pub fn get(&self, field: &str) -> Option<&dyn ToSql>; }

Trait to translate SQL row to struct and vice versa.

You probably should use the Entity derive macro instead of writing the impl by yourself.

Required methods

pub fn from(tuple: &Tuple<'_>) -> Self[src]

Create a new struct from SQL result.

pub fn get(&self, field: &str) -> Option<&dyn ToSql>[src]

Get the value of the field named field.

Loading content...

Implementations on Foreign Types

impl<T: FromSql + ToSql, S: BuildHasher + Default> Entity for HashMap<String, T, S>[src]

impl<T: FromSql + ToSql, S: BuildHasher + Default> Entity for HashMap<usize, T, S>[src]

Loading content...

Implementors

impl Entity for Column[src]

impl Entity for Composite[src]

impl Entity for Domain[src]

impl Entity for Enum[src]

impl Entity for Relation[src]

impl Entity for Schema[src]

impl<T: ToSql + FromSql> Entity for T[src]

Loading content...