// Generated by moonmodel from models.mbt. Edit those files, not this one.
///|
let home_description : @moonmodel.Model = @moonmodel.Model::new(
"Address",
[
@moonmodel.Field::new("city", Text),
@moonmodel.Field::new(
"zip",
Text,
check=@moonmodel.Check::new(pattern="^[0-9]{5}$"),
),
],
doc="where somebody lives",
)
///|
pub fn Home::describe() -> @moonmodel.Model {
home_description
}
///|
let user_description : @moonmodel.Model = @moonmodel.Model::new(
"User",
[
@moonmodel.Field::new(
"id",
Big,
doc="assigned by the database",
check=@moonmodel.Check::new(unique=true),
),
@moonmodel.Field::new(
"name",
Text,
check=@moonmodel.Check::new(shortest=1, longest=64),
),
@moonmodel.Field::new(
"email",
Text,
required=false,
nullable=true,
check=@moonmodel.Check::new(format="email"),
),
@moonmodel.Field::new(
"age",
Int,
required=false,
nullable=true,
check=@moonmodel.Check::new(least=0.0, most=150.0),
),
@moonmodel.Field::new(
"role",
Text,
check=@moonmodel.Check::new(options=["Admin", "Member", "Guest"]),
),
@moonmodel.Field::new(
"weight",
Real,
required=false,
default=1.0,
check=@moonmodel.Check::new(over=0.0),
),
@moonmodel.Field::new("home", Ref("Address")),
@moonmodel.Field::new(
"tags",
List(Text),
check=@moonmodel.Check::new(longest=8, distinct=true),
),
@moonmodel.Field::new("joined", Stamp),
@moonmodel.Field::new(
"count",
Wire(
@moonmodel.Layout::new(
Int,
bits=16,
unsigned=true,
order=@moonmodel.Order::Big,
reference=true,
),
),
),
],
doc="somebody with an account",
)
///|
pub fn User::describe() -> @moonmodel.Model {
user_description
}