A Go package that enhances database/sql with powerful data retrieval methods and DB-agnostic query building.
ozzo-dbx is a Go package that enhances the standard `database/sql` library by adding powerful data retrieval methods and a database-agnostic query builder. It solves the problem of writing repetitive and error-prone SQL code by providing a structured, programmatic way to build and execute queries while maintaining compatibility with major relational databases.
Go developers working with relational databases who need a lightweight, non-ORM tool to simplify query building, reduce boilerplate, and safely interact with SQL databases.
Developers choose ozzo-dbx because it offers a clean, expressive API for database operations without the overhead of a full ORM, keeps them close to SQL, and ensures DB portability with built-in quoting and parameter binding for security.
A Go (golang) package that enhances the standard database/sql package by providing powerful data retrieval methods as well as DB-agnostic query building capabilities.
Populates query results directly into structs, maps, or slices with configurable field mapping using struct tags, reducing boilerplate for data retrieval as shown in the README's examples for populating nested structs.
Programmatically constructs SELECT, INSERT, UPDATE, DELETE queries that work across SQLite, MySQL, PostgreSQL, and others, with automatic table and column quoting for portability, demonstrated in the query building sections.
Uses named parameters like `{:ParamName}` to prevent SQL injection, ensuring safe query execution without manual escaping, as highlighted in the binding parameters section.
Provides Insert, Read, Update, Delete methods on model structs with minimal code, though limited to simple primary keys, as detailed in the CRUD operations part of the README.
Lacks advanced ORM capabilities such as automatic relationship handling, schema migrations, and lazy loading, which are common in full-featured ORMs like GORM, forcing developers to handle these manually.
Query building only works fully for five databases; the README admits that for other databases, it may not work as expected, requiring custom builder implementation.
CRUD Model methods do not support composite primary keys—for example, SelectQuery.Model() fails here, forcing use of lower-level query building with Where() clauses, as noted in the Read section.
Generate type-safe code from SQL
Fluent SQL generation for golang
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server
Type safe SQL builder with code generation and automatic query result data mapping
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.