Relationships
Entity Associations & Integrity
GDL makes modeling complex distributed associations trivial. Relations are defined outside of the entity blocks to maintain a clean, declarative architectural blueprint.
The Social Network of Data
// relationship Type Parent to Child
relationship 1:m Customer to Order
relationship m:1 Order to Customer
Relationships in GO-DUCK are directional. The generator automatically injects foreign keys, GORM preloading logic, and Protobuf nested objects based on these declarations.
Supported Association Types
👨👩👧
1:m (One-to-Many)
One parent entity owns multiple children. Perfect for Customers having many Orders.
relationship 1:m Customer to Order
🔗
m:1 (Many-to-One)
Multiple entities reference a single shared resource. Multiple Car entities belonging to a single Manufacturer.
relationship m:1 Car to Manufacturer
Referential Integrity Modifiers
⚓
required
By adding the `required` keyword to any relationship, GO-DUCK enforces strict existence checking at the database and API level.
relationship 1:m Customer to Order required