Derive Macro rorm::Patch

source ·
#[derive(Patch)]
{
    // Attributes available to this derive:
    #[rorm]
}
Expand description
use rorm::{Model, Patch};

#[derive(Model)]
struct User {

    #[rorm(id)]
    id: i32,

    #[rorm(max_length = 255, unique)]
    username: String,

    #[rorm(max_length = 255)]
    password: String,

    #[rorm(default = false)]
    admin: bool,

    age: i16,
}

#[derive(Patch)]
#[rorm(model = "User")]
struct InsertNormalUser {
    // id set by database

    username: String,

    password: String,

    // admin defaults to false

    age: i16,
}