Are there any decent ORMs in Golang?

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
  • scany

    Library for scanning data from a database into Go structs and more

  • When I don't use one, I'm typically using SQLx or (if using Postgres) pgx with scany https://github.com/georgysavva/scany (slightly better API than SQLx and great performance since you can use the native interface from pgx if desired whereas many database drivers only offer the text-based interface).

  • ent

    An entity framework for Go

  • I think the best ORM in Go is Ent: https://entgo.io/ It has great docs, great migration capabilities, and is well run with professional staff. The only downside is that some people don't like the approach of code generation.

  • 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
  • goose

    A database migration tool. Supports SQL migrations and Go functions.

  • sqlc

    Generate type-safe code from SQL

  • I have been using: https://sqlc.dev/ With pgx for Postgres and liking it so far. It does code generation. But seems pretty easy to maintain. And there is no reflection at runtime, so performance is good.

  • SQLBoiler

    Generate a Go ORM tailored to your database schema.

  • sqlboiler

  • Squirrel

    Fluent SQL generation for golang

  • But using a query builder, something like squirrel or (plug) bqb, allows you to actually write SQL (or something close to it) when you need it but also handles the nasty string building bits. Though I agree that ORMs are not always bad, especially for small projects with well-defined scope.

  • bqb

    BQB is a lightweight and easy to use query builder that works with sqlite, mysql, mariadb, postgres, and others.

  • But using a query builder, something like squirrel or (plug) bqb, allows you to actually write SQL (or something close to it) when you need it but also handles the nasty string building bits. Though I agree that ORMs are not always bad, especially for small projects with well-defined scope.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
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