What is the best way to use PostgreSQL with Go?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • GORM

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

  • I will add a fourth choice that I have been using with PostgreSQL and it’s fantastic! https://gorm.io/ gorm

  • SQLBoiler

    Generate a Go ORM tailored to your database schema.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • pggen

    Generate type-safe Go for any Postgres query. If Postgres can run the query, pggen can generate code for it.

  • I created pggen a few weeks ago to create my preferred method of database interaction: I write real SQL queries and I use generated, type-safe Go interfaces to the queries. https://github.com/jschaf/pggen

  • sqlc

    Generate type-safe code from SQL

  • The project is new but pretty well tested; bug reports welcome. Sqlc is a more mature code generator in the same design space with a different implementation that I can also recommend. https://github.com/kyleconroy/sqlc

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts