Dapper-like ORM, Mapping

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

Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • SonarLint - Clean code begins in your IDE with SonarLint
  • 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

    A tutorial for Go's database/sql package

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Platform where developers build real-time applications for analytics, IoT and cloud-native services. Easy to start, it is available in the cloud or on-premises.

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

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

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