Generate a complete Go database access layer from an existing PostgreSQL schema in minutes instead of writing queries by hand.
Add type-safe eager loading of related records and automatic timestamp handling to a Go application.
Use raw SQL fallback alongside generated code for complex queries the generator cannot express.
Requires a running database and a config file pointing SQLBoiler at it before any code generation can happen.
SQLBoiler is a Go code generator that reads your existing database schema and produces Go code for working with your database. Rather than writing repetitive database queries by hand, you run SQLBoiler once, and it produces a tailored set of Go functions and types that match your specific tables and columns. The generated code handles common operations like inserting, updating, deleting, and querying rows, and it knows about the relationships between your tables. The approach is described as "database-first": you design and manage the database schema yourself using migration tools of your choice, and SQLBoiler's only job is to generate the access layer on top of it. This is the opposite of some other tools where you define your data models in code and let the tool create the database. The benefit of the database-first approach is that the generated code is fully type-safe and specific to your schema, so mistakes like passing the wrong type to a query are caught at compile time rather than at runtime. The generated code supports eager loading of related records, hooks that run before or after database operations, transactions, raw SQL fallback for anything the generator cannot express, automatic handling of created-at and updated-at timestamps, and enum types. Supported databases include PostgreSQL, MySQL, Microsoft SQL Server, SQLite, and CockroachDB. The README opens with a note that the project is now in maintenance mode. It still accepts bug fixes and compatibility updates from the community but no longer adds new features, and the maintainers generally do not resolve reported issues. The README points to two actively maintained alternatives: Bob (a project directly inspired by SQLBoiler, created by a former SQLBoiler maintainer) and sqlc (a different approach that generates type-safe code from SQL queries rather than from the schema). Only version 4 is currently maintained. Versions 1, 2, and 3 are no longer supported. The full README is longer than what was shown.
← aarondl on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.