Skip to main content

CHECK

Constant CHECK 

Source
pub const CHECK: ColumnMarker;
Expand description

Adds a CHECK constraint to a column (check = "...") or a table (check(name = "...", expr = "...")). The expression is raw SQL.

ยงExamples

#[column(check = "score >= 0")]
score: i32,

#[SQLiteTable(check(name = "score_range", expr = "score >= 0 AND score <= 100"))]
struct Scores {
    score: i32,
}

See: https://sqlite.org/lang_createtable.html#check_constraints