Entities
An entity represents a data object. It contains fields with specific types and constraints.Field types
SLang supports high-level primitives that map to optimized database storage:| Type | Description |
|---|---|
TEXT | Strings of text. |
NUMBER | Integers or floating point numbers. |
BOOLEAN | true or false. |
DATE | Calendar date (YYYY-MM-DD). |
DATE_TIME | Timestamp. |
EMAIL | Validated email string. |
URL | Validated web link. |
CURRENCY_AMOUNT | Monetary value. |
ENUM("a", "b") | Restricted set of strings. |
Field constraints & metadata
Fields can be configured with nested properties:description: Documentation for the field (visible in generated APIs/docs).minLength: Enforces minimum character count for TEXT.:=: Sets a default value.?: Marks the field as optional (nullable).
Relations
Relations define how entities connect. They are defined outside the entity block to keep definitions clean. The syntax is:relation Left[FieldOnLeft] Cardinality --- Cardinality Right[FieldOnRight]
One-to-many
A Clinic has many Patients; a Patient belongs to one Clinic.Clinic.Patientswill return a list of patients.Patient.Clinicwill return a single clinic.