Trait diesel::deserialize::FromSqlRow[][src]

pub trait FromSqlRow<A, DB: Backend>: Sized {
    const FIELDS_NEEDED: usize;

    fn build_from_row<T: Row<DB>>(row: &mut T) -> Result<Self>;
}
Expand description

Deserialize one or more fields.

All types which implement FromSql should also implement this trait. This trait differs from FromSql in that it is also implemented by tuples. Implementations of this trait are usually derived.

In the future, we hope to be able to provide a blanket impl of this trait for all types which implement FromSql. However, as of Diesel 1.0, such an impl would conflict with our impl for tuples.

Deriving

This trait can be automatically derived by Diesel for any type which implements FromSql. There are no options or special considerations needed for this derive. Note that #[derive(FromSqlRow)] will also generate a Queryable implementation.

Associated Constants

The number of fields that this type will consume. Must be equal to the number of times you would call row.take() in build_from_row

Required methods

See the trait documentation.

Implementations on Foreign Types

Implementors