pub fn from_row<'facet, T: Facet<'facet>>(row: &Row) -> Result<T>Expand description
Deserialize a tokio-postgres Row into any type implementing Facet.
The type must be a struct with named fields. Each field name is used to look up the corresponding column in the row.
§Example
ⓘ
use facet::Facet;
use facet_tokio_postgres::from_row;
#[derive(Debug, Facet)]
struct User {
id: i32,
name: String,
active: bool,
}
let row = client.query_one("SELECT id, name, active FROM users LIMIT 1", &[]).await?;
let user: User = from_row(&row)?;