This edition
SQL-compiler or sqlc generates type-safe Go code from SQL migrations and queries. Most developers use it as a black box, but understanding how it works matters because great engineers don’t just use tools — they understand them, question them, and get better by knowing what’s happening under the hood.
We are going trace the compilation pipeline inside sqlc: how it delegates parsing to PostgreSQL’s own parser via pg_query_go, builds an in-memory schema catalog, performs query analysis and type inference across joins, CTEs, and subqueries, and finally generates Go code for PostgreSQL and pgx driver.
LEVEL: Intermediate
Past editions
The talk begins with a review of the evolution of working with Postgres in Go: from the standard library’s database/sql, through Squirrel + sqlx, pgx driver and API, to modern SQL-first approaches with sqlc. It then introduces an AI-powered generator that creates repository layers based on provided interfaces and domain models, leveraging sqlc-generated queries. The generator, playfully named sqlc++, is powered by Claude Code with a custom command and uses a GitHub project with a reference implementation as an example. This reference-based approach reduces LLM hallucinations and ensures consistent code style.
This approach makes it easier to bootstrap a new repository: in addition to what sqlc already requires (SQL schema and queries), one has to define domain models and a repository interface. From there, the sqlc++ generator produces the repository implementation and integration tests, ensuring consistency and avoiding repetitive boilerplate.
LEVEL: Intermediate
