ORM or no ORM (and which ones)?

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

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.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • 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.

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

  • 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

  • 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

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

  • tinyORM

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

  • bun

    SQL-first Golang ORM (by uptrace)

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

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

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

  • sqload

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

  • sqload

  • goyesql

    Go + Yesql (by nleof)

  • Yesqlgoyesql

  • jet

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

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

  • goqu

    SQL builder and query library for golang

  • SQL Builders (think squirrel or goqu)

  • 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