CLI vs Gen
gorm.io/gen arrived before Go generics. It generates full DAO structs and its own query layer. The newer CLI (gorm cmd) leans on generics, keeps the generated surface small, and sticks close to existing gorm APIs.
How to choose
- Stay with Gen when you depend on its DAO chainers or database-to-model scaffolding.
- Prefer the CLI when you want lightweight helpers, typed methods defined by interfaces, and minimal divergence from core
gormpatterns.
Migration path
- Generate CLI output into a new package (for example
internal/generated). - Switch one module at a time to call
generated.Query[...]andgorm.G[...]instead of DAO structs. - Remove Gen output once you have replaced the DAO usage you no longer need.
CLI roadmap
- Additional commands such as
vet(tag and association validation) andmigration.
Head back to the CLI overview or read the gorm/gen documentation.