Modeller
ArchitectureLegacy Design Drafts

Data Types

Data Types

This document defines the type system for domain definitions.


Primitive Types

TypeDescriptionExample
textVariable-length stringName: text
text(N)String with max lengthCode: text(10)
integer32-bit whole numberCount: integer
long64-bit whole numberSizeBytes: long
decimalArbitrary-precision decimalRate: decimal
decimal(P,S)Decimal with precision and scaleRate: decimal(10,4)
booleanTrue or falseIsActive: boolean
dateDate without timeStartDate: date
timeTime without dateOpenTime: time
datetimeDate and timeCreatedAt: datetime
guidGlobally unique identifierToken: guid
nameSmart name with casing variantsFirstName: name
binaryRaw binary dataData: binary
idGenerated unique identifier (key fields only)ChildId: id
emailEmail addressContactEmail: email
urlWeb addressWebsiteUrl: url

Standard Library Types

These types are defined in the lib/ standard library. Use them by name — the code generator resolves their canonical definition.

Value Types

TypeDescriptionLibrary file
moneyISO 4217 monetary amount — integer minor units + text(3) currency codelib/money.value
percentagePercentage value stored as decimal(7,4)lib/percentage.value
geospatialWGS84 coordinate pair — latitude and longitude as decimal(10,7)lib/geospatial.value
# Using standard library value types in an entity
entity RoomSessionFee
  "Fee schedule for a room session"

  Schedule1Amount: money "The schedule 1 fee amount"
  CCSPercentage: percentage "The CCS entitlement percentage"
end

entity Centre
  "A childcare centre"

  Name: name "Centre name"
  Location: geospatial, optional "Geographic coordinates"
end

Union Types

Union types represent values with multiple possible shapes. The generator selects the appropriate variant based on infrastructure configuration.

TypeDescriptionVariantsLibrary file
imageBinary image — inline or external referenceEmbedded, Referencelib/image.union
documentBinary document — inline or external referenceEmbedded, Referencelib/document.union
# Using union types in an entity
entity Child
  "A child enrolled at a centre"

  FirstName: name "First name"
  Image: image, optional "Child's photo"
end

entity CertificateSupportingEvidenceDocument
  "A supporting document for an ACCS certificate"

  Document: document "The attached evidence document"
end

The Embedded variant stores binary data directly in the data store (supported by SQL Server). The Reference variant stores a storage key pointing to an external blob store. Infrastructure rules determine which variant is used at generation time.


Defining Your Own Types

Value Objects (.value)

User-defined immutable value objects composed of primitives:

value DateRange
  "A period between two dates"

  Start: date "Start of the range"
  End: date "End of the range (inclusive)"
end

Union Types (.union)

User-defined discriminated unions with two or more named variants:

union ContactMethod
  "How to contact a person"

  variant Email
    Address: email "Email address"
  end

  variant Phone
    Number: text(20) "Phone number"
    Extension: text(10), optional "Extension"
  end
end

Field Modifiers

ModifierSyntaxMeaning
Optional, optionalField may be null/absent
Default value, default(value)Value used when not supplied
entity Booking
  "A planned attendance"

  Status: BookingStatus, default(Planned) "Current state"
  Notes: text(500), optional "Free text notes"
  IsActive: boolean, default(true) "Whether the booking is active"
end

The id Type

id is a shorthand for a generated unique identifier used exclusively in .key files. It implies guid, generated — the field is a GUID and is automatically assigned on creation.

key Child
  ChildId: id
end

Both forms are equivalent; id is preferred in new files:

# equivalent (older style)
key Child
  ChildId: guid, generated
end

Implementation Mapping

DSL TypeC#SQL ServerSQLite
textstringnvarchar(max)TEXT
text(N)stringnvarchar(N)TEXT
integerintintINTEGER
longlongbigintINTEGER
decimal(P,S)decimaldecimal(P,S)NUMERIC
booleanboolbitINTEGER
dateDateOnlydateTEXT
timeTimeOnlytimeTEXT
datetimeDateTimedatetime2TEXT
guidGuiduniqueidentifierTEXT
namestringnvarchar(100)TEXT
binarybyte[]varbinary(max)BLOB
idGuiduniqueidentifierTEXT
emailstringnvarchar(254)TEXT
urlstringnvarchar(2048)TEXT
moneyMoney (value object)two columns: bigint + char(3)two columns
percentagePercentage (value object)decimal(7,4)NUMERIC
geospatialGeospatial (value object)two columns: decimal(10,7) × 2two columns
imageImage (union)variant-dependentvariant-dependent
documentDocument (union)variant-dependentvariant-dependent

On this page