For un ORM pour Go qui gère les migrations, the strongest matches are go-xorm/xorm (xorm is a Go ORM that includes a built-in), uptrace/bun (uptrace/bun is a type-safe Go ORM with a built-in) and go-gorm/gorm (GORM is the most popular Go ORM and natively). go-pg/pg and ent/ent round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Découvrez des bibliothèques ORM Go efficaces qui incluent des outils intégrés de migration et de versioning de schéma de base de données.
xorm is a relational mapper and object-relational mapping tool for Go. It translates Go structures into SQL queries and maps database rows back into native objects, providing a multi-dialect database driver that supports MySQL, PostgreSQL, SQLite, Oracle, SQL Server, and TiDB. The project features a read-write splitting manager that routes modification requests to a primary database and read requests to replicas. It includes a database schema synchronizer to automatically align table structures and indexes with application data models, as well as a fluent SQL query builder for constructing co
xorm is a Go ORM that includes a built-in schema synchronizer for automatic database migrations, a fluent query builder, and supports multiple SQL dialects, directly matching the need for a lightweight ORM with integrated migration capabilities.
Bun is a type-safe object relational mapper for Go that prioritizes SQL-first query construction and result mapping. It functions as a programmable SQL query builder, a database connection manager, and a tool for mapping database tables to Go structs. The project distinguishes itself through a multi-dialect SQL support system, allowing a single codebase to interact with different database engines via a consistent interface. It includes a built-in database observability tool for query interception, distributed tracing, and logging, as well as a schema migration tool for versioning structural c
uptrace/bun is a type-safe Go ORM with a built-in schema migration tool and a SQL-first query builder, making it a comprehensive fit for this search without needing external migration tools.
GORM is a developer-focused object-relational mapping library for Go that provides a comprehensive data persistence framework. It serves as a database access layer, allowing developers to map application structures to database tables and perform CRUD operations using a fluent, type-safe query builder instead of writing raw SQL. The library distinguishes itself through its association-aware persistence, which automatically tracks and synchronizes complex entity relationships during database operations. It utilizes a driver-agnostic interface to maintain consistent behavior across various stora
GORM is the most popular Go ORM and natively includes AutoMigrate for schema changes, giving you a built-in migration system alongside its type-safe query builder, CRUD operations, and relational associations—exactly the all-in-one, lightweight ORM you’re looking for.
pg is a PostgreSQL object-relational mapper (ORM) for Go that maps Go structs to database tables and provides a fluent query builder for constructing SQL statements programmatically. At its core, it automatically generates CREATE TABLE statements from Go struct definitions using struct tags and naming conventions, and builds queries through method chaining with placeholder-based parameter binding to prevent SQL injection. The library distinguishes itself through relation-aware join generation that automatically constructs JOIN clauses for has-one, has-many, many-to-many, and polymorphic assoc
go-pg/pg is a Go ORM for PostgreSQL that auto-generates tables from struct definitions and provides a fluent query builder, fitting the core request for an ORM with built-in migration support, though its migration capabilities are limited to schema generation rather than providing versioned up/down migrations.
Ent is a statically typed entity framework for Go that models database structures as a graph of nodes and edges. It functions as a code generation engine that transforms schema definitions into type-safe database clients, query builders, and migration scripts. By representing data as interconnected entities, the framework enables intuitive traversal of complex relationships and ensures that database interactions remain consistent with the application model at compile time. The framework distinguishes itself through its graph-based approach to data modeling and its reliance on compile-time cod
Ent is a statically typed entity framework and ORM for Go that includes a built-in migration system via code-generated migration scripts, making it a solid fit for your need for a Go ORM with integrated migrations, though its code-generation approach adds complexity beyond what "lightweight" typically implies.
Data Access Layer (DAL) for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
upper/db is a Go database abstraction layer with ORM-like features and support for multiple databases, fitting the lightweight ORM requirement, but it does not include a built-in migration system, so it falls short of the migration capability specified.