Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. reform

reform

MITGov1.5.1

A better ORM for Go, based on non-empty interfaces and code generation via go generate.

Visit WebsiteGitHubGitHub
1.5k stars74 forks0 contributors

What is reform?

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.

Target Audience

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.

Value Proposition

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.

Overview

A better ORM for Go, based on non-empty interfaces and code generation.

Use Cases

Best For

  • Building Go applications that require compile-time type safety for database operations, avoiding runtime errors common with reflective ORMs.
  • Generating boilerplate code for existing database schemas using the `reform-db` command to quickly scaffold type-safe models.
  • Implementing CRUD operations with straightforward methods like `Save`, `FindByPrimaryKey`, `FindAll`, and `Delete` across supported SQL dialects (PostgreSQL, MySQL, SQLite3, Microsoft SQL Server).
  • Working with nullable database fields using Go pointers or `sql.NullXXX` types without sacrificing type safety.
  • Integrating database layers in projects where performance is critical, as reform's code generation minimizes runtime overhead compared to reflection-based ORMs.
  • Developing in teams that value idiomatic Go APIs and clear documentation, as reform's design avoids the pitfalls of type system sidestepping.

Not Ideal For

  • Applications requiring composite primary keys, as reform explicitly does not support them.
  • Projects that rely on dynamic, runtime-generated SQL queries without pre-defined models, since reform's type-safe approach depends on code generation.
  • Teams needing built-in database migration tools, as reform focuses solely on ORM functionality without schema management features.
  • Systems with frequent database schema changes that demand automatic model updates, as reform requires manual regeneration of code after schema alterations.

Pros & Cons

Pros

Type-Safe Interfaces

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.

Code Generation Performance

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.

Multi-Dialect Compatibility

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.

Idiomatic CRUD Methods

Provides simple methods like Save, FindByPrimaryKey, and Delete for common operations, making database interactions straightforward and Go-idiomatic, as shown in the quickstart example.

Cons

No Composite Primary Keys

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.

Code Generation Overhead

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.

Limited Advanced Queries

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.

Frequently Asked Questions

Quick Stats

Stars1,457
Forks74
Contributors0
Open Issues62
Last commit8 months ago
CreatedSince 2016

Tags

#hacktoberfest#mssql#orm#database#postgresql#golang#type-safe#mysql#sqlite#go#code-generation#sql

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 9 hours ago

Related Projects

GORMGORM

The fantastic ORM library for Golang, aims to be developer friendly

Stars39,949
Forks4,179
Last commit2 months ago
entent

An entity framework for Go

Stars17,196
Forks1,009
Last commit4 days ago
SQLBoilerSQLBoiler

Generate a Go ORM tailored to your database schema.

Stars6,990
Forks559
Last commit1 month ago
bunbun

SQL-first Golang ORM

Stars4,963
Forks302
Last commit17 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub