rorm icon indicating copy to clipboard operation
rorm copied to clipboard

Support database-level constraints on columns

Open CrsiX opened this issue 3 years ago • 0 comments

It would be nice to see support for check constraints which are based on database features. Of course, the support for those must be evaluated first. Below is a short example how using the constraints could look like, but I'm open for other suggestions as well:

#[derive(Clone, Debug, Model)]
struct User {
    #[rorm(id)]
    id: i64,

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

    #[rorm(unsigned)]
    age: i32,

    #[rorm(constraint = "< 1337")]
    score: i32
}

CrsiX avatar Nov 09 '22 22:11 CrsiX