Skip to main content

SqlxGen

Derive Macro SqlxGen 

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

No-op derive macro that registers sqlx_gen as a helper attribute.

This allows #[sqlx_gen(...)] to be used on both structs and fields without the compiler rejecting them as unknown attributes.

§Usage

Add SqlxGen to your derive list:

#[derive(sqlx::FromRow, SqlxGen)]
#[sqlx_gen(kind = "table", table = "users")]
pub struct Users {
    #[sqlx_gen(primary_key)]
    pub id: i32,
}