Skip to main content

SqlxModel

Derive Macro SqlxModel 

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

Derive macro that implements SqlxModel for a table-backed row type.

#[auth(table = "...")] names the physical table; the id field is the primary key. Physical column names follow #[sqlx(rename = "...")] and #[sqlx(rename_all = "...")], and #[auth(column_type = "...")] overrides a column’s inferred category. The struct must also derive sqlx::FromRow.