Dapper-like ORM, Mapping

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

    general purpose extensions to golang's database/sql

  • Beyond that, as others have suggested, sqlx is very close to dapper in terms of functionality. It’s not generic, but generics don’t actually get you anything here except dapper will instantiate the types for you while with sqlx you have to do it yourself. Under the hood, both must use reflection to map fields.

  • go-database-sql-tutorial

    Discontinued A tutorial for Go's database/sql package

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

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

  • Just my opinion, so it it for what it’s worth to you, but I haven’t been especially impressed with the ORM landscape in Go. I have tinkered with a few ORMs - I gave gorm a serious whirl a few months ago, but ended up ditching it in less than a month. If time is on your side, I’d strongly encourage you to experiment with what the standard library’s database/sql package has to offer.

  • ent

    An entity framework for Go

  • Try https://github.com/ent/ent :D

  • sqlc

    Generate type-safe code from SQL

  • Since you’re using postgres, I’d recommend sqlc if it fits your use case: https://github.com/kyleconroy/sqlc

  • pgx

    PostgreSQL driver and toolkit for Go

  • If your schema/migrations are not part of the go project then it might not be a great fit. It does support pgx which is a huge advantage imo vs plain database/sql.

  • sqlh

    Powerful struct scanning for Go's database/sql and other compatible interfaces.

  • You might also consider https://github.com/nofeaturesonlybugs/sqlh as an alternative to sqlx.

  • 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