ORM or no ORM (and which ones)?

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

InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video.
Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
getstream.io
featured
  1. sqlc

    Generate type-safe code from SQL

    SQL code generator (aka inspect a database or SQL files to generate data models). You have the option of using something like volatiletech/sqlboiler which looks at the a physical database and generates code based on the schema. Or SQLC which is an amazing and fast project.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. Squirrel

    Fluent SQL generation for golang

    I personally do the no ORM approach, often combining query-builders with SQL drivers (sqlx + squirrel) as to avoid raw SQL in my code. You can build composable query this way and it lessens the likelihood of someone accidentally creating a SQL injection vulnerability.

  4. almanack

    Predicts future sports scores

    You just write more queries and sqlc will make ad hoc types for you. I have a bunch of code here: https://github.com/spotlightpa/almanack/tree/master/internal/db https://github.com/spotlightpa/almanack/tree/master/sql/queries

  5. GORM

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

    Hello, I want to communicate with a database in my go API. My API is for a website that allows you to track finances and budgets, so the reason I need a database is to store the user's expenses and allow them to search and find each one and which one is costing them the most. I also am going to implement login soon, but I don't think that matters for now. I'm now stuck on how to communicate with my database (Postgres). Should I go with an ORM like gorm, database/sql package, sqlx, or any others? Advice is appreciated

  6. sqlx

    general purpose extensions to golang's database/sql

    https://github.com/jmoiron/sqlx and github.com/lib/pq are pretty solid, this is what i go to.

  7. tinyORM

    A tiny package for your basic data layer needs (by BitlyTwiser)

  8. bun

    SQL-first Golang ORM (by uptrace)

    This way: https://github.com/uptrace/bun, I prefer in all cases with PostgreSQL

  9. Stream

    Stream - Scalable APIs for Chat, Feeds, Moderation, & Video. Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.

    Stream logo
  10. ent

    An entity framework for Go

    Check out https://entgo.io/ I like the approach to define an entity schema first and let handle entgo the query part.

  11. sqload

    Load your SQL queries from .sql files instead of writing the SQL code in your Go source files.

    sqload

  12. goyesql

    Go + Yesql (by nleof)

    Yesqlgoyesql

  13. jet

    Type safe SQL builder with code generation and automatic query result data mapping

    Use sql builder https://github.com/go-jet/jet.

  14. goqu

    SQL builder and query library for golang

    SQL Builders (think squirrel or goqu)

  15. SQLBoiler

    Generate a Go ORM tailored to your database schema.

    SQL code generator (aka inspect a database or SQL files to generate data models). You have the option of using something like volatiletech/sqlboiler which looks at the a physical database and generates code based on the schema. Or SQLC which is an amazing and fast project.

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

  • Go ORMs Compared

    5 projects | dev.to | 18 Jan 2024
  • Tenha controle sobre seu SQL com Golang e SQLC

    3 projects | dev.to | 25 Nov 2023
  • GORM is a bad idea?

    5 projects | /r/golang | 10 May 2022
  • The Power of Generics in Go: The Repository pattern for GORM

    2 projects | /r/golang | 22 Apr 2022
  • Sql generator but for SQLite

    4 projects | /r/golang | 26 Dec 2021