What’s your preferred setup to work with SQL DB (without ORM) ?

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

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. sqlx

    general purpose extensions to golang's database/sql

    I basically use the db/sql package/interface, but I use sqlx for its StructScan ability that will scan straight into my db struct rather than having to scan into the individual fields.

  2. SaaSHub

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

    SaaSHub logo
  3. sqlc

    Generate type-safe code from SQL

    sqlc for Postgresql databases is really nice. MySQL also works but has more issues and currently they are working on SQLite support.

  4. sqlf

    sqlf generates parameterized SQL statements in Go, sprintf style

    sqlf for building parameterized queries, yet to settle on a row-to-struct mapper, doing it manually for now

  5. go-sqlite

    Low-level Go interface to SQLite 3

    I like and use https://github.com/zombiezen/go-sqlite for CGo-free SQLite. It avoids some of the problems database/sql has, discussed here: https://crawshaw.io/blog/go-and-sqlite.

  6. Dapper

    Dapper - a simple object mapper for .Net

    sqlx has worked pretty well for me if you are looking for a fairly light wrapper. I wish there was an equivalent of the dapper library for C#/.NET.

  7. bun

    SQL-first Golang ORM (by uptrace)

    Though, i've would give a try to bun

  8. xo

    Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server (by xo)

    i use xo . Reason is i prefer designing schema first and creating golang scaffolding later. Xo takes schema and gives me basic create/update/delete operations by default and i can also generate gocode for any sql queries that i write.

  9. Squirrel

    Fluent SQL generation for golang

    We have used squirrel (https://github.com/Masterminds/squirrel) for query building and sqlx as a database/sql wrapper quite extensively.

  10. sqly

    Simple database/sql helper library to execute queries (by dstpierre)

    That's what I'm trying to remove with sqly (Scully). But it's mostly a PoC at this moment.

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

  • How to handle migrations in Golang

    5 projects | dev.to | 11 Jun 2024
  • Using migrations with Golang

    5 projects | dev.to | 17 Apr 2024
  • API completa em Golang - Parte 1

    8 projects | dev.to | 1 Dec 2023
  • Is there a similar tool or alternative in Go like strong_migrations?

    3 projects | /r/golang | 30 Apr 2023
  • How do you handle migrations ?

    6 projects | /r/golang | 15 Apr 2023

Did you know that Go is
the 4th most popular programming language
based on number of references?