ormlette/ir/ir
This is an intermediate representation
(IR) for the schema definition to convert it to a SQL CREATE TABLE
statement.
The IR is a data structure that represents the schema in a way that is easy to convert to SQL.
Types
Ir type for a column constraint, such as a PRIMARY KEY
, FOREIGN KEY
, UNIQUE
, etc.
pub type ColumnConstraint {
PrimaryKey
Nullable
Unique
ForeignKey(
references_table: TableIR,
references_column: String,
on_delete: Option(String),
on_update: Option(String),
)
}
Constructors
-
PrimaryKey
-
Nullable
-
Unique
-
ForeignKey( references_table: TableIR, references_column: String, on_delete: Option(String), on_update: Option(String), )
This is the IR type for a column.
pub type ColumnIR {
ColumnIR(
name: String,
type_: create.ColumnType,
constraints: List(ColumnConstraint),
default: Option(dynamic.Dynamic),
)
}
Constructors
-
ColumnIR( name: String, type_: create.ColumnType, constraints: List(ColumnConstraint), default: Option(dynamic.Dynamic), )