Fetching latest headlines…
sqlex — A Modern Drop-in Replacement for jmoiron/sqlx
NORTH AMERICA
🇺🇸 United StatesJune 27, 2026

sqlex — A Modern Drop-in Replacement for jmoiron/sqlx

2 views0 likes0 comments
Originally published byDev.to

title: sqlex — A Modern Drop-in Replacement for jmoiron/sqlx
published: false
description: sqlex is a fully API-compatible modernization of jmoiron/sqlx that fixes 20+ long-standing bugs, adds pluggable hooks, auto IN expansion, and more. Built for Go 1.21+.
tags: go, database, sql, opensource
cover_image: https://opengraph.githubassets.com/1/go-sqlex/sqlex

If you use sqlx, this is worth 3 minutes of your time

jmoiron/sqlx has been the go-to SQL extension library for Go for years. Struct mapping, named parameters, IN clause expansion — it made database/sql actually pleasant to use. I've used it in almost every Go project I've worked on.

But here's the problem: it's basically frozen.

The last proper release was in 2021. Hundreds of issues are sitting untouched. PRs go unanswered. Bugs that the community has reported years ago are still there, waiting to bite someone in production.

This isn't a knock on sqlx — it's a great library with solid design. But an unmaintained foundational library is a liability.

So we built sqlex

sqlex is a drop-in replacement for jmoiron/sqlx that is 100% API-compatible. All sqlx methods (Get, Select, Exec, NamedQuery, Preparex, etc.) work identically.

Migrating takes 30 seconds — just change the import path:

- import "github.com/jmoiron/sqlx"
+ import "github.com/go-sqlex/sqlex"

🐛 20+ bug fixes from sqlx, all fixed

🚀 New features sqlx never had
-- Auto-Rebind — write ? everywhere, works on PostgreSQL ($1), MySQL (?), SQLite (?), SQL Server (@p1). No more manual db.Rebind().

-- SQL parsing fixes — colons in strings, :: type casts, ? in comments are correctly handled. Silent bugs from sqlx are gone.

-- Auto IN expansion — slices in IN (?) are detected and expanded automatically on all methods.

-- Hook system — pluggable SQL interceptors for logging, tracing, metrics (onion model).

-- JSONValue[T] — generic JSON column type with auto serialize/deserialize.

-- StrictMode — lenient by default (matching sqlx Unsafe()), optionally strict for debugging.

-- Unified interfaces — Ext / ExtContext / NamedExt / BindExt with compile-time checks.

Project status
Version: v1.5.3 (just released, actively maintained)

Go version: 1.21+

Test coverage: 80%+

License: MIT

100% API-compatible with sqlx

sqlx was great for its time, and its design still holds up. But the lack of maintenance — the unfixed lexer bugs, the inconsistent APIs, the silent data corruption issues — adds real cost to real projects.

sqlex isn't a rewrite. It's a modernization that keeps what sqlx got right and fixes what it got wrong.

If you're using sqlx and you've run into any of the issues above, give sqlex a try. The migration is trivial, and the improvements are real.

GitHub: https://github.com/go-sqlex/sqlex

Comments (0)

Sign in to join the discussion

Be the first to comment!