[][src]Trait sqlx_core::row::FromRow

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

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>

Loading content...

Implementors

Loading content...