Lightweight derive macros for bringing orm-like features to sqlx.
Example: Table
Example: Patch
Documentation
See the docs of derive(Table) and derive(Patch).
Lightweight derive macros for bringing orm-like features to sqlx.
#[derive(ormx::Table)]
#[ormx(table = "users", id = user_id, insertable)]
struct User {
#[ormx(column = "id")]
user_id: u32,
first_name: String,
last_name: String,
#[ormx(get_optional(&str))]
email: String,
#[ormx(default, set)]
last_login: Option<NaiveDateTime>,
}
#[derive(ormx::Patch)]
#[ormx(table_name = "users", table = User, id = "id")]
struct UpdateName {
first_name: String,
last_name: String,
}
See the docs of derive(Table) and derive(Patch).