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
  • InfluxDB - Access the most powerful time series database as a service
  • SonarQube - Static code analysis for 29 languages.
  • 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.

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

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

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

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