# GORM Gen

A code generator for GORM that creates type-safe Go data-access code and query methods from a database schema or interface-based SQL templates.

GORM Gen generates a data-access layer for Go projects that use GORM. Pointed at a database schema, or at Go interfaces written with SQL templates, it produces idiomatic DAO code and a type-safe query DSL for fields, conditions and assignments, including a generics mode.

Generated code follows GORM conventions for tags such as nullable, default, unsigned, index and type, and works with the GORM plugins and dialectors a project already uses. A single generator entry point controls what gets generated and how the query API looks, through mode flags such as WithDefaultQuery, WithQueryInterface and WithGeneric.

It is written in Go and installed as a library with go get, then run from a small generator command a project defines itself.

Website: https://gorm.io/gen/
