Skip to main content

Model

Derive Macro Model 

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

Implements rustclamp::db::Model for a struct with named fields: each field is read from the column of the same name.

ⓘ
#[derive(Model)]
#[model(table = "posts")]
pub struct Post {
    pub id: i64,
    pub title: String,
    pub published_at: Option<String>,
}

The table is always named: a guessed plural would get categories wrong.