Which SQL driver to use with Postgres

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

Our great sponsors
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • Scout APM - Less time debugging, more time building
  • OPS - Build and Run Open Source Unikernels
  • GitHub repo pq

    Pure Go Postgres driver for database/sql

    For convenience, it is better to use https://github.com/lib/pq in conjunction with https://github.com/jmoiron/sqlx, you will have all the data in json

  • GitHub repo go-sql-driver/mysql

    Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package (by go-sql-driver)

    I'm following Alex Edwards web dev book, he uses MySQL with go-sql-driver/mysql , i want to use Postgres, which one should I use?

  • SonarLint

    Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.

  • GitHub repo pgx

    PostgreSQL driver and toolkit for Go

  • GitHub repo sqlc

    Generate type-safe code from SQL

    I can recommend pairing it with sqlc: https://github.com/kyleconroy/sqlc

  • GitHub repo sqlx

    general purpose extensions to golang's database/sql

    For convenience, it is better to use https://github.com/lib/pq in conjunction with https://github.com/jmoiron/sqlx, you will have all the data in json

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