A Go library for building SQL queries and mapping results, providing a lightweight alternative to ORMs.
Gendry is a Go library that assists with database operations by providing tools for building SQL queries and scanning results into Go structs. It solves the problem of writing and maintaining raw SQL manually while avoiding the overhead and complexity of traditional ORMs. The library integrates seamlessly with Go's standard `database/sql` package and MySQL drivers.
Go developers working with MySQL databases who need a lightweight, maintainable way to construct SQL queries and handle result mapping without adopting a full ORM.
Developers choose Gendry for its simplicity, control over SQL, and reduced boilerplate. It offers a pragmatic middle ground between raw SQL and ORMs, with features like a flexible query builder and efficient struct scanning.
a golang library for sql builder
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The map-based interface allows constructing complex queries with conditions, aggregations, and raw SQL snippets, as shown in examples for WHERE clauses with IN operators and multi-OR conditions.
Reflection-based scanner maps rows to structs with custom tags (default 'ddb') and supports unmarshalers, reducing boilerplate code compared to manual row scanning.
Manager component simplifies setting up connection pools with driver-specific parameters like charset and timeouts, integrating seamlessly with go-sql-driver/mysql.
Avoids ORM abstractions, giving developers direct SQL control while reducing manual query building, as emphasized in the philosophy of complementing standard libraries.
Built specifically for MySQL via go-sql-driver/mysql, making it unsuitable for projects using other databases without significant workarounds.
Scanner relies on reflection for struct mapping, which can introduce performance costs and runtime errors compared to compile-time approaches in other libraries.
Lacks ORM-like capabilities such as migrations, relationships, or transaction helpers, requiring manual implementation for complex database operations.
For highly nested or dynamic queries, the map-based builder can become cumbersome and less readable than raw SQL or more expressive builders.