Associations
Field helpers make it easy to touch parents and related records in one builder. Here’s how the generated structs combine.
Update parent fields and append children
err := gorm.G[User](db). |
The generator emits helpers for each association (Profiles, Devices). Chain them inside the same Set(...) call alongside parent updates.
Replace many-to-many links
err := gorm.G[Team](db). |
Unlink clears existing join rows, and CreateInBatch seeds the new slice—no manual join-table work needed.
Create a parent with nested associations
err := gorm.G[Order](db). |
A single Create(ctx) call inserts the parent and cascades through the generated association helpers.
Return to Transactions or the CLI overview.