#[derive(FromRow)]
{
// Attributes available to this derive:
#[column]
}
Expand description
Implements From<&Row>
trait for a struct, allowing direct conversion from a database row to the struct.
ยงExample
use tokio_postgres_utils::FromRow;
#[derive(FromRow)]
struct User {
id: i32,
name: String,
}
Expand into:
impl From<&Row> for User {
fn from(row: &Row) -> Self {
Self {
id: row.get("id"),
name: row.get("name"),
}
}
}