How bg12345/gorm-dbobjects works
gorm-dbobjects lets Go applications define triggers, views, and stored procedures as dialect-agnostic builders, then render or apply their DDL through a Client backed by GORM. The main workflow is builder → Client → connection-selected dialect → rendered DDL, with registration executing statements and handling rollback according to DDL transaction support. Builder validation uses GORM schema metadata; views also render GORM query callbacks. The excerpts show the central orchestration and dialect layer, but not every dialect implementation detail.
Main entry points: dbobjects.go Client · dialect.go DDL rendering · trigger.go Trigger builder · procedure.go Procedure builder
Components 12
Object builders
- Trigger builder
trigger/trigger.go - View builder
view/view.go - Procedure builder
procedure/procedure.go
Client runtime
- Client
dbobjects.go - Compensating cleanup
dbobjects.go
Dialect rendering
- Dialect dispatch
dialect.go - DDL rendering
dialect.go
Other components
- Go application
- GORM schema
- GORM connection
- SQL database
- Schema tool
Connections 16
- Go application → Trigger builder: builds trigger
- Go application → View builder: builds view
- Go application → Procedure builder: builds procedure
- Trigger builder → GORM schema: validates fields
- Procedure builder → GORM schema: derives types
- Go application → Client: registers or renders
- Client → Dialect dispatch: resolves engine
- Client → GORM connection: uses connection
- Dialect dispatch → DDL rendering: selects renderer
- DDL rendering → View builder: renders query callback
- DDL rendering → SQL database: produces DDL for
- Client → SQL database: executes DDL
- Client → Compensating cleanup: cleans partial batch
- Compensating cleanup → SQL database: drops applied objects
- Go application → Schema tool: supplies rendered DDL
- Client → Schema tool: renders DDL