Discover efficient Go object-relational mapping libraries that include integrated database schema migration and versioning 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 storage engines and employs a reflection-based system to map programming language types to database schemas. Developers can further customize behavior using a callback-based hook system that executes logic at specific points in the operation lifecycle. Beyond core mapping, the project provides robust support for transaction management, connection pooling, and automated schema migrations. It handles complex relational modeling, including one-to-one, one-to-many, and many-to-many associations, while offering advanced features like eager loading, soft deletes, and conflict resolution strategies for upsert operations. The framework is designed for integration into Go applications, providing a unified interface for managing database connectivity and transactional integrity.
GORM is a comprehensive Go ORM that provides a fluent query builder, robust struct mapping, and integrated schema migration tools, making it a flagship solution for your requirements.
GF is a comprehensive Go application toolkit and web framework. It provides a set of libraries and tools for building scalable web applications, APIs, and enterprise-level software. The project features a driver-agnostic SQL database toolkit with a query builder and object mapper, alongside a dedicated framework for creating structured command line interfaces. It includes a project scaffolding tool to bootstrap application structures and automate development workflows. The toolkit covers several broader capability areas, including concurrent data management with thread-safe collections, cryptographic operations for security, and a stack-aware error handling system. It also provides utilities for background task scheduling, adapter-based configuration management, and local service orchestration for containerized infrastructure.
This is a comprehensive web framework that includes a robust, driver-agnostic ORM and SQL builder, though it is a broader toolkit rather than a standalone library dedicated solely to ORM and migration tasks.
Squirrel is a Go database library and SQL query builder that provides a programmatic interface for constructing and executing SQL statements. It enables the creation of queries using a fluent interface to avoid manual string concatenation. The library functions as a SQL dialect generator, producing queries formatted for specific database engines by adjusting placeholders and syntax to match target requirements. This allows for the generation of SQL compatible with multiple different database environments. Beyond query construction, the project covers the execution of generated statements against database connections. It provides a means to assemble type-safe queries that are maintained as structured representations before being rendered into raw SQL.
This is a fluent SQL query builder rather than a full-featured ORM, meaning it lacks the struct-to-database mapping and integrated schema migration tools required for your project.