Skip to main content

Model

Derive Macro Model 

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

Implements Model for a struct, mapping each field to a column.

Type-level #[model(table = "messages", actions = "duplicate")] sets the table name (defaults to the lowercased type name plus s) and lists row-action functions. Field attributes: #[key], #[references("table.column")], #[via("through.mine.theirs")], #[default(value)].