[][src]Trait sqlx::FromRow

pub trait FromRow<'c, R> where
    R: Row<'c>, 
{ fn from_row(row: &R) -> Result<Self, Error>; }

A record that can be built from a row returned by the database.

In order to use query_as the output type must implement FromRow.

Deriving

This trait can be automatically derived by SQLx for any struct. The generated implementation will consist of a sequence of calls to Row::try_get using the name from each struct field.

ⓘThis example is not tested
#[derive(sqlx::FromRow)]
struct User {
    id: i32,
    name: String,
}

Required methods

fn from_row(row: &R) -> Result<Self, Error>

Loading content...

Implementations on Foreign Types

impl<'c, T1> FromRow<'c, PgRow<'c>> for (T1,) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T5: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T6: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T7: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T8: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4, T5) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T5: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4, T5, T6, T7) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T5: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T6: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T7: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2> FromRow<'c, MySqlRow<'c>> for (T1, T2) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3, T4> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2> FromRow<'c, PgRow<'c>> for (T1, T2) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4, T5, T6) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T5: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T6: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4, T5, T6) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>,
    T5: 'c + Type<MySql> + Decode<'c, MySql>,
    T6: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3, T4, T5> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4, T5) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>,
    T5: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3, T4> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1> FromRow<'c, MySqlRow<'c>> for (T1,) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8, T9> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8, T9) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T5: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T6: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T7: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T8: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T9: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4, T5, T6) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T5: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T6: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8, T9> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8, T9) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T5: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T6: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T7: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T8: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T9: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3, T4, T5) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T4: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T5: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3> FromRow<'c, SqliteRow<'c>> for (T1, T2, T3) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T3: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4, T5, T6, T7) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T5: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T6: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T7: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2> FromRow<'c, SqliteRow<'c>> for (T1, T2) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>,
    T2: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8, T9> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8, T9) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>,
    T5: 'c + Type<MySql> + Decode<'c, MySql>,
    T6: 'c + Type<MySql> + Decode<'c, MySql>,
    T7: 'c + Type<MySql> + Decode<'c, MySql>,
    T8: 'c + Type<MySql> + Decode<'c, MySql>,
    T9: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1, T2, T3> FromRow<'c, PgRow<'c>> for (T1, T2, T3) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8> FromRow<'c, PgRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8) where
    T1: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T2: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T3: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T4: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T5: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T6: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T7: 'c + Type<Postgres> + Decode<'c, Postgres>,
    T8: 'c + Type<Postgres> + Decode<'c, Postgres>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7, T8> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4, T5, T6, T7, T8) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>,
    T5: 'c + Type<MySql> + Decode<'c, MySql>,
    T6: 'c + Type<MySql> + Decode<'c, MySql>,
    T7: 'c + Type<MySql> + Decode<'c, MySql>,
    T8: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

impl<'c, T1> FromRow<'c, SqliteRow<'c>> for (T1,) where
    T1: 'c + Type<Sqlite> + Decode<'c, Sqlite>, 
[src]

impl<'c, T1, T2, T3, T4, T5, T6, T7> FromRow<'c, MySqlRow<'c>> for (T1, T2, T3, T4, T5, T6, T7) where
    T1: 'c + Type<MySql> + Decode<'c, MySql>,
    T2: 'c + Type<MySql> + Decode<'c, MySql>,
    T3: 'c + Type<MySql> + Decode<'c, MySql>,
    T4: 'c + Type<MySql> + Decode<'c, MySql>,
    T5: 'c + Type<MySql> + Decode<'c, MySql>,
    T6: 'c + Type<MySql> + Decode<'c, MySql>,
    T7: 'c + Type<MySql> + Decode<'c, MySql>, 
[src]

Loading content...

Implementors

Loading content...