Expand description
Deserialize tokio-postgres Rows into any type implementing Facet.
This crate provides a bridge between tokio-postgres and facet, allowing you to
deserialize database rows directly into Rust structs that implement Facet.
§Example
ⓘ
use facet::Facet;
use facet_tokio_postgres::from_row;
#[derive(Debug, Facet)]
struct User {
id: i32,
name: String,
email: Option<String>,
}
// After executing a query...
let row = client.query_one("SELECT id, name, email FROM users WHERE id = $1", &[&1]).await?;
let user: User = from_row(&row)?;Enums§
- Error
- Error type for Row deserialization.
Functions§
- from_
row - Deserialize a tokio-postgres Row into any type implementing Facet.
Type Aliases§
- Result
- Result type for Row deserialization.