Command Palette

Search for a command to run...

position in category
#2

Full-featured ORM library for Go that maps structs to database tables and provides a fluent API for queries, associations, and migrations. Supports SQLite, MySQL, PostgreSQL, and SQL Server through pluggable drivers, with auto-migration from struct definitions and a type-safe generics API introduced in v1.30.

Backed by sponsors such as Encore.dev, incident.io, and Bytebase. Compared to lighter alternatives like sqlx or sqlc, GORM offers a conventional ActiveRecord-style API with associations, hooks, and eager loading out of the box, while remaining extensible via plugins for read-write splitting, Prometheus metrics, and multi-database resolution.

Core capabilities:

  • Associations: has one, has many, belongs to, many to many, polymorphism, single-table inheritance
  • Hooks for before/after create, save, update, delete, and find operations
  • Eager loading with Preload and Joins, batch inserts, FindInBatches
  • Transactions with nested transactions, save points, and rollback
  • Auto migrations from struct definitions, composite primary keys, indexes, and constraints
  • Extensible plugin API: database resolver for multiple databases and read-write splitting

Well suited for Go services that need rapid schema evolution and rich relationship handling without hand-written SQL. Fits microservices and APIs where struct-based models, migrations, and transaction support reduce boilerplate. Integrates cleanly with standard Go idioms, context propagation, and prepared statement mode for production workloads.

GitHub Repositories
225
-2.6%
Trending down this week
Removed in 6 repos