Go ORMs Compared

This page summarizes the projects mentioned and recommended in the original post on dev.to

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

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

  • GORM is a comprehensive ORM tool in Go, offering a code-first approach which allows defining database schemas using struct tags in Go. It's known for its developer-friendly nature, making it suitable for both beginners and experienced users. GORM supports a variety of SQL databases like MySQL, PostgreSQL, and SQLite. It's designed to be flexible, allowing developers to drop down to raw SQL when necessary. However, it's important to be cautious about its performance implications in large-scale applications.

  • sqlc

    Generate type-safe code from SQL

  • sqlc is not strictly a conventional ORM. It offers a unique approach by generating Go code from SQL queries. This allows developers to write SQL, which sqlc then converts into type-safe Go code, reducing the boilerplate significantly. It ensures that your queries are syntactically correct and type-safe. sqlc is ideal for those who prefer writing SQL and are looking for an efficient way to integrate it into a Go application.

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

    Templates for Encore (by encoredev)

  • Encore is designed to work well with sqlc and is a simple method of trying it out, as Encore will take care of provisioning your databases automatically. Check out this hello-world example app using Encore and sqlc on GitHub.

  • ent

    An entity framework for Go

  • ent is a fairly recent ORM that uses a code-first approach where you define your schema in Go code. Ent is popular thanks to its ability to handle complex data models and relationships elegantly. It's statically typed, which can help catch errors at compile time. However, the learning curve might be steeper compared to more straightforward ORMs like GORM. It's a good fit for applications where complex data models and type safety are priorities.

  • SQLBoiler

    Generate a Go ORM tailored to your database schema.

  • SQLBoiler takes a database-first approach, generating Go code from your database schema. This means it creates highly optimized and custom-tailored code for your specific database schema. SQLBoiler is great for applications where the database schema is well-defined and changes infrequently. However, like sqlc, it requires regenerating the code when the database schema changes. It's well-suited for projects where performance is a key concern and the database design is stable​.

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