A better ORM for Go, based on non-empty interfaces and code generation via go generate.
reform is an ORM (Object-Relational Mapper) for Go and the standard `database/sql` package. It provides a type-safe, idiomatic alternative to traditional Go ORMs by leveraging Go's type system and code generation, avoiding runtime reflection and empty interfaces. This approach results in better performance, compile-time safety, and clearer APIs for database interactions.
Go developers building applications that require type-safe, performant database interactions with PostgreSQL, MySQL, SQLite3, or Microsoft SQL Server. It is suited for teams prioritizing compile-time checks and idiomatic Go design over runtime flexibility.
Developers choose reform over other Go ORMs because it eliminates runtime reflection and empty interfaces (`interface{}`), using code generation and non-empty interfaces for full compiler validation and better tooling support. Its focus on simplicity and leveraging Go's native type system provides a more predictable and efficient database layer.
A better ORM for Go, based on non-empty interfaces and code generation.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses non-empty interfaces instead of `interface{}`, enabling full compiler checks and better IDE support, which catches errors early as described in the README's philosophy.
Generates boilerplate via `go generate` or the `reform` command, eliminating runtime reflection for better performance and compile-time validation, as highlighted in the key features.
Supports PostgreSQL, MySQL, SQLite3, and MS SQL Server with stable, tested drivers, ensuring reliable cross-database use as detailed in the README's dialect table.
Provides simple methods like Save, FindByPrimaryKey, and Delete for common operations, making database interactions straightforward and Go-idiomatic, as shown in the quickstart example.
reform explicitly does not support composite primary keys, limiting its use with databases that rely on multi-column primary keys, as stated in the caveats section.
Changes to the database schema require regenerating models with `go generate` or the reform command, adding manual steps and potential sync issues in evolving projects.
While efficient for basic CRUD, reform lacks built-in support for complex joins, aggregations, or subqueries, often necessitating raw SQL for advanced operations beyond its simple API.