{"repo":"go-gorm/gen","free":true,"listed":false,"github":"https://github.com/go-gorm/gen","clone":"git clone https://github.com/go-gorm/gen.git","description":"Gen: Friendly & Safer GORM powered by Code Generation","language":"Go","stars":2557,"topics":["generator","golang","gorm"],"license":"MIT","category":"dev-tools","readme_excerpt":"GORM Gen Friendly & Safer GORM powered by Code Generation. Overview - Generate idiomatic, reusable DAO APIs from database schema and/or interface-based SQL templates - Type-safe query DSL (fields, conditions, assignments) with strong static typing (including generics mode) - Database-to-struct follows GORM conventions (tags, nullable/default/unsigned/index/type, etc.) - Built on top of GORM: use the same plugins, dialectors, and ecosystem you already have Documentation - Gen Guides (official site): https://gorm.io/gen/index.html - GORM Guides: https://gorm.io/docs Quick Start Install as a library: 1) Generate code Create a generator entry (recommended: cmd/gen/main.go ): Run generation: 2) Use generated code If you enabled WithDefaultQuery , initialize once at startup: query.SetDefault(db) only needs to run once (e.g. during service startup). After that, use query. directly. If you don’t want a global default, skip WithDefaultQuery and use: More runnable examples: examples Common Setups Gen has one generator entry point ( gen.NewGenerator(gen.Config{...}) ). The main knobs you typically use are: - What to generate: DB schema → models/query; plus optional interface-SQL methods - How the query API looks: Config.Mode flags ( WithDefaultQuery , WithoutContext , WithQueryInterface , WithGeneric ) Setup A: DB schema → model + query (recommended baseline) Setup B: Interface SQL templates → reusable typed methods Define an interface with SQL comments/templates: Bind the interface to ","default_branch":null,"files":null,"tree":[],"storefront":"/r/go-gorm","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/go-gorm/gen/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}