#[derive(Model)]
{
// Attributes available to this derive:
#[orm]
}
Expand description
Derive Model metadata for a struct.
§Example
ⓘ
use pgorm::Model;
#[derive(Model)]
#[orm(table = "users")]
struct User {
#[orm(id)]
user_id: i64,
username: String,
email: Option<String>,
}§Generated
TABLE: &'static str- Table nameCOL_*: &'static str- Column name constantsSELECT_LIST: &'static str- Comma-separated column listfn select_list_as(alias: &str) -> String- Aliased column list for JOINs
§Attributes
#[orm(table = "name")]- Specify table name (required)#[orm(id)]- Mark field as primary key#[orm(column = "name")]- Map field to different column name