Skip to main content

CHECK

Constant CHECK 

Source
pub const CHECK: ColumnMarker;
Expand description

Adds a CHECK constraint to a column or table.

ยงExamples

#[column(CHECK = "age >= 0")]
age: i32,

#[PostgresTable(CHECK(name = "valid_score", expr = "score >= 0 AND score <= 100"))]
struct Scores {
    score: i32,
}

See: https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS