Entities & Fields

Data Modeling & Type System

Entities represent the core data structures of your microservice. Each entity is mapped to a GORM model, a Protobuf message, and a PostgreSQL table.

The Declaration Syntax

GDL supports two declaration styles for flexibility, though the Type-First approach is the modern standard for elite developers.

Modern Style (Type-First)
string(100) fullName required
datetime lastLogin
jsonb metadata
                
Classic Style (Field-First)
fullName String required
lastLogin DateTime
metadata JSONB
                

Global Type System Reference

GDL Type Go Native SQL (Postgres)
string(N) string VARCHAR(N)
text string TEXT
int / integer int INTEGER
long int64 BIGINT
bool / boolean bool BOOLEAN
json / jsonb datatypes.JSON JSON / JSONB
datetime / instant time.Time TIMESTAMP
uuid uuid.UUID UUID

Field Modifiers

required

Strict Integrity

Adds `NOT NULL` to the SQL schema and marks the field as required in Protobuf and Gin validation hooks.

unique

Natural Key Protection

Automatically creates a unique index in PostgreSQL to prevent duplicate records across all silos.