Skip to content

Types — ASL

A concrete type maps to a database table.

type User {
required email: str;
name: str;
required age: int32;
}

The keyword model is accepted as a synonym for type.

Abstract types have no table of their own. They exist only to be extended by other types.

abstract type Timestamped {
required id: uuid {
default := gen_uuid();
constraint pk;
};
required created_at: datetime { default := datetime_current(); };
required updated_at: datetime {
default := datetime_current();
rewrite update := datetime_current(); # keep it fresh on every UPDATE
};
}

default only fires on INSERT, so without the rewrite line updated_at would never change. See Rewrites.

Abstract types are meant to be reused through inheritance.