Last Updated: May 22, 2026
github.com/jmoiron/sqlx is a thin wrapper around the standard database/sql package that adds two things people end up rewriting by hand: scanning rows directly into structs and using named parameters in queries. It's not an ORM, it doesn't manage migrations, and it doesn't hide SQL. sqlx.DB embeds *sql.DB, so every method you've learned in this section still works, plus a few new ones that cut the boilerplate around reads and writes.
The examples in this chapter need two third-party packages. In a real project you'd run go get github.com/jmoiron/sqlx and go get modernc.org/sqlite once, then import them like any standard library package. The schema is the same products and customers tables we've used throughout this section.