A Go library for relational persistence that maps structs to database tables with minimal boilerplate.
Gorp is a Go library for relational persistence that maps Go structs to database tables, automating common CRUD operations while keeping developers close to SQL. It solves the problem of repetitive database boilerplate code by generating SQL statements and handling result binding automatically. The library supports transactions, optimistic locking, and schema generation for streamlined database interactions.
Go developers building applications that interact with SQL databases and want to reduce boilerplate code without adopting a full-featured ORM. It's particularly useful for those who prefer writing SQL but want automation for common tasks.
Developers choose Gorp for its simplicity and minimal abstraction—it provides just enough automation to save time without hiding SQL. Unlike heavier ORMs, it avoids complex relationship mapping and stays predictable, making it ideal for projects where control and transparency are priorities.
Go Relational Persistence - an ORM-ish library for Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Maps Go structs to database columns using tags or API, eliminating repetitive SQL for CRUD operations. README shows examples with 'db' tags for column names and sizes.
Stays close to SQL, allowing raw query writing while automating boilerplate. README emphasizes it's not a full ORM, giving developers control over SQL.
Includes optimistic locking with version columns and transaction support, preventing data conflicts. README details how to set up version columns with SetVersionCol().
Can create database tables from structs using CreateTablesIfNotExists(), useful for unit testing and prototyping. README highlights this for easy setup.
Does not manage associations between structs, requiring manual SQL joins for related data. README admits it doesn't know about relationships, limiting use for complex models.
Maintenance has slowed since 2016, with infrequent updates and reliance on PRs, as noted in the README update. This could lead to outdated features or bugs.
Raw SQL queries may need manual adjustment for different databases due to placeholder syntax differences. README warns about this in the 'Known Issues' section.