NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Go modules
Go modules, #1125 by repository stars
Latest stable
v1.44.1
Last release 1 months ago
23 Oct 2026
Ships fairly regularly
a new release about every 5 weeks
Most releases are documented
notes for 43 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
127 releases · first in 2018
Drag across the ruler to compare, or tap a release to open it.
[FIX] Preserve nil values when flattening argument lists, so List keeps SQL NULL arguments by @yuefdev in https://github.com/huandu/go-sqlbuilder/pull
[FIX] Preserve nil values when flattening argument lists, so List keeps SQL NULL arguments by @yuefdev in https://github.com/huandu/go-sqlbuilder/pull/250[FIX] Support underscores and digits in PostgreSQL dollar-quote tags, and avoid treating dollar signs inside identifiers as quote delimiters by @yuefdev in https://github.com/huandu/go-sqlbuilder/pull/249Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.44.0...v1.44.1
[FIX] Round SQLite and Presto timestamps to the millisecond they print by @SashaMIT in #247
[FIX] Round SQLite and Presto timestamps to the millisecond they print by @SashaMIT in #247Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.43.0...v1.44.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
[FIX] Interpolate: keep ClickHouse whole-number floats and non-finite values typed correctly by @youdie006 in #244
[FIX] Interpolate: keep ClickHouse whole-number floats and non-finite values typed correctly by @youdie006 in #244[FIX] Escape ANSI interpolation string literals in #246[FIX] Escape identifier delimiters in Flavor.Quote in #245Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.42.0...v1.43.0
v1.42.0 was published with an incorrect module path (github.com/webdaad/go-sqlbuilder) accidentally introduced by PR #239 . Restore the correct path (
v1.42.0 was published with an incorrect module path
(github.com/webdaad/go-sqlbuilder) accidentally introduced by PR #239.
Restore the correct path (github.com/huandu/go-sqlbuilder) and add a
retract directive so the broken version is not picked up by go get.
[NEW] Add an option NoExpand to change default field "expand" behavior for backward compatibility. See #237 for details.
[NEW] Add an option NoExpand to change default field "expand" behavior for backward compatibility. See #237 for details.NOTE: Starting from v1.40.0, the Struct utility type defaults to expanding non-primitive struct fields. This change caused unexpected behavior for some users. To address this without reverting the features introduced in v1.40.0, we have introduced a NoExpand configuration. When set to true, all fields will default to no expansion (preserving legacy behavior). You can still opt-in to expansion for specific fields by using the fieldopt:"expand" tag.
Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.40.0...v1.41.0
fix #236 : New fieldopt "noexpand" to treat a nested struct as one column
fix #236: New fieldopt "noexpand" to treat a nested struct as one column
fix #234 : field names in INSERT INTO should not include table name
fix #234: field names in INSERT INTO should not include table name
Support treating a db tag on a struct-typed field as a database alias and expanding its exported fields as aliased columns. This makes it possible to
Support treating a db tag on a struct-typed field as a database alias and expanding its exported fields as aliased columns. This makes it possible to build JOIN projections like post.id, post.title, etc., from a nested struct field and keeps Addr/Scan behavior working by allocating nested pointers when scanning.
Note: This change preserves existing semantics for scalar-like structs (types implementing sql.Scanner/driver.Valuer/time.Time, etc) — they are not expanded.
See issue #233 for more details.
SELECT behaviorUse OFFSET ... FETCH pattern for Oracle SELECT pagination.
Potential Oracle compatibility note: the change to use OFFSET ... FETCH for Oracle pagination may affect environments using older Oracle versions that do not support this syntax. Please verify compatibility with your Oracle version before upgrading.
Thanks to @zhangyongding for the Oracle pagination improvements.
Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.39.0...v1.40.0
Merge pull request #231 from zhangyongding/chore-oralce-select-offset…
Merge pull request #231 from zhangyongding/chore-oralce-select-offset…
[FIX] Mark OrderBy as "not recommended" rather than deprecated by in #223
[NEW] Add From support for UpdateBuilder by @stvnkiss in #230[FIX] Fix oracle limit bug by @zhangyongding in #222[FIX] Improve error-msg context for unsupported types during interpolation by @shoriwe in #226[FIX] Mark OrderBy as "not recommended" rather than deprecated by in #223[FIX] Fix sqlite string interpolation incorrectly uses backslash escapes by @shoriwe in #228[FIX] Update doc on Where to avoid confusion in #229Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.38.0...v1.39.0
Nothing published for this version
Nothing published for this version
The old methods OrderBy/Asc/Desc are marked as deprecated. #214
JOIN. #217OrderByAsc and OrderByDesc to SelectBuilder/UpdateBuilder/DeleteBuilder/UnionBuilder for better readability. The old methods OrderBy/Asc/Desc are marked as deprecated. #214Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.37.0...v1.38.0
[NEW] Support clone (deep copy) in all builders
Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.36.0...v1.37.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add a fuzz harness for Select by @edznux-dd in #207
UpdateBuilder and DeleteBuilder in #212Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.35.0...v1.36.0
Nothing published for this version
Nothing published for this version
NEW: New flavor Doris, which is a dialect of MySQL. See discussion in #192 for details.
Doris, which is a dialect of MySQL. See discussion in #192 for details.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.34.0...v1.35.0
Thanks @stavros-k for raising this issue in #186.
args in LIMIT and/or OFFSET expression to optimize query plan caching.
RETURNING in InsertBuilder.
Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.33.0...v1.34.0
Nothing published for this version
Nothing published for this version
Support LATERAL keyword #181 #183 (Thanks @therve for your ideas)
LATERAL keyword #181 #183 (Thanks @therve for your ideas)
LateralAs in SelectBuilder to build LATERAL JOIN expression. Read sample code for LateralAs on GoDoc for details.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.32.0...v1.33.0
Nothing published for this version
NEW: Flavor getters by @rodionovv in #177
Flavor getters by @rodionovv in #177
Flavor() in Builder to get current flavor set in a builder.CTETables in DELETE and UPDATE statements. #179
CTETable to automatically include the CTE table name in the FROM clause of SELECT statements has now been extended to UPDATE and DELETE statements.Cond is misused. #180
Cond for building various conditions, which is a misuse, but we cannot completely prevent this error.NewCond(), the generated SQL will include the pattern /* INVALID ARG $n */, where n is the sequence number of the problematic variable, allowing users to quickly pinpoint the issue.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.31.0...v1.32.0
Nothing published for this version
Nothing published for this version
Cond and WhereClause will actively ignore empty content to prevent the output of syntactically incorrect SQL #175 by @rodionovv
Cond and WhereClause will actively ignore empty content to prevent the output of syntactically incorrect SQL #175 by @rodionovv
Cond and WhereClause can produce syntax errors when any of required parameters field, op or expr is empty. This release fixes this issue by actively ignore these invalid values.Select("*").From("t").Where("").String()
SELECT * FROM tSELECT * FROM t WHEREsb := Select("*").From("t"); sb.Where(sb.Equal("", 0))
SELECT * FROM tSELECT * FROM t WHERE = ?Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.30.0...v1.31.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add "IS [NOT] DISTINCT FROM" comparison operators to Cond #169
Cond #169Cond can automatically build compatible syntax as a substitute.IsDistinctFrom("field", value) automatically determines which expression to output based on the current database flavor. If the flavor is PostgreSQL, it builds "field IS DISTINCT FROM $1". For MySQL, which does not support this operator, it builds the functionally equivalent expression "NOT field <=> ?".Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.29.1...v1.30.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
CTETableBuilder has been repurposed as a type alias for CTEQueryBuilder and is deprecated. It is advised that this alias may be phased out in upcoming…
Following discussions in issue #161, @arikkfir and I have tackled several key gaps in the Common Table Expression (CTE) related APIs:
WITH RECURSIVE clause;JOIN and WHERE clauses, excluding FROM;WITH support in UPDATE and DELETE statements.To introduce these features, we've made substantial API updates designed to be backward compatible, ensuring no disruption to existing implementations. However, all users of the CTE APIs should be cognizant of these enhancements.
CTEQuery vs CTETable:
CTEBuilder to the FROM clause of a SELECT statement, which hindered the exclusive use of CTE tables in JOIN or WHERE clauses.CTEQuery constructs CTE queries without any unintended consequences; meanwhile, CTETable retains its original functionality, effectively turning the previous side effect into a deliberate feature.CTEQueryBuilder:
CTEQueryBuilder is now the sole builder for crafting CTE query expressions, replacing the previous approach.CTETableBuilder has been repurposed as a type alias for CTEQueryBuilder and is deprecated. It is advised that this alias may be phased out in upcoming releases.SelectMore in SelectBuilder allows for the addition of further columns to a SELECT statement post the Select() method call.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.28.0...v1.29.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Implement CTEBuilder and CTETableBuilder to support Common Table Expression (CTE) by @huandu in #157
CTEBuilder and CTETableBuilder to support Common Table Expression (CTE) by @huandu in #157
With and CTEBuilder.SelectBuilder, UpdateBuilder and DeleteBuilder by @abanoub-fathy in #159Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.27.3...v1.28.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Due to the importance of the WHERE statement in SQL, we often need to continuously append conditions and even share some common WHERE conditions among
Due to the importance of the WHERE statement in SQL, we often need to continuously append conditions and even share some common WHERE conditions among different builders. Therefore, we abstract the WHERE statement into a WhereClause struct, which can be used to create reusable WHERE conditions.
I hope the WhereClause can help more developers to build more and more valuable SQL/DB related packages on top of this package. It's extremely welcome!
WhereClause: A new dedicated builder for WHERE. Thanks for raising this idea to me in #145, @LeDuyViet.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.26.0...v1.27.0
Nothing published for this version
## What's Changed * #140 Feature: New flavor Informix. Thanks for your contribution, @zhangyongding. Full Changelog: https://github.com/huandu/go-sqlb
Informix. Thanks for your contribution, @zhangyongding.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.25.0...v1.26.0
Nothing published for this version
Per discussion in #134, add methods to return number of required clause in builders, so that we can know whether a builder can build a valid SQL. Than
Per discussion in #134, add methods to return number of required clause in builders, so that we can know whether a builder can build a valid SQL. Thanks @0x9ef for raising this issue.
Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.24.0...v1.25.0
Nothing published for this version
## What's Changed * #133 Add sub-select builder for InsertBuilder to support INSERT INTO ... SELECT statement. Thanks, @cemremengu. Full Changelog: ht
InsertBuilder to support INSERT INTO ... SELECT statement. Thanks, @cemremengu.Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.23.0...v1.24.0
One column per quarter.