database libraries

last updated: Oct 20, 2023


Jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder with code generation and automatic query result data mapping.
Jet currently supports PostgreSQL, MySQL, MariaDB and SQLite. Future releases will add support for additional databases.



Simple, yet powerful entity framework for Go, that makes it easy to build and maintain applications with large data-models.


sqlc generates type-safe code from SQL. Here's how it works:

  1. You write queries in SQL.
  2. You run sqlc to generate code with type-safe interfaces to those queries.
  3. You write application code that calls the generated code.


SQLBoiler is a tool to generate a Go ORM tailored to your database schema.

It is a "database-first" ORM as opposed to "code-first" (like gorm/gorp). That means you must first create your database schema. Please use something like sql-migrate or some other migration tool to manage this part of the database's life-cycle.


xo is a command-line tool to generate idiomatic code for different languages code based on a database schema or a custom query.

its author was very rude to me when I asked a question on the gopher slack, so I prefer not to use this library any longer 🤷‍♂️


I'm not a fan of runtime ORM for go (or in general...), but I'll include it here for completeness

The fantastic ORM library for Golang, aims to be developer friendly.


Not an entity framework or database mapper, but tool for building sql queries at runtime

Squirrel helps you build SQL queries from composable parts:

import sq "" users := sq.Select("*").From("users").Join("emails USING (email_id)") active := users.Where(sq.Eq{"deleted_at": nil}) sql, args, err := active.ToSql() sql == "SELECT * FROM users JOIN emails USING (email_id) WHERE deleted_at IS NULL"
↑ up