Skip to main content

FromRow

Derive Macro FromRow 

Source
#[derive(FromRow)]
{
    // Attributes available to this derive:
    #[orm]
}
Expand description

Derive FromRow trait for a struct.

§Example

use pgorm::FromRow;

#[derive(FromRow)]
struct User {
    id: i64,
    username: String,
    #[orm(column = "email_address")]
    email: Option<String>,
}

§Attributes

  • #[orm(column = "name")] - Map field to a different column name