Releases: huandu/go-sqlbuilder
New feature: Support new flavor `Oracle`
What's Changed
- #118, #126: Support new flavor
oracle
. Thanks for your contribution, @zhangyongding. - #125: Add new alias functions in
Cond
for better readability.
Full Changelog: v1.22.0...v1.23.0
New feature: Tuple and enhanced SQL injection
What's Changed
- #108: Support tuple now. See Tuple sample to understand how to use it.
- #115: All builders follow a new rule - don't generate a SQL clause if related values are not set. This feature enables us to write SQL like this
NewSelectBuilder().SQL("SELECT foo FROM bar").Where(/*...*/)
.
Full Changelog: v1.21.0...v1.22.0
New feature: Flavor for Presto and Exists/NotExists/All/Any/Some for conditions
What's Changed
Full Changelog: v1.20.0...v1.21.0
New feature: Filter struct fields using WithTag and WithoutTag
When we build an UPDATE or INSERT SQL with Struct
, we may need to filter out struct fields representing primary key or those should not be updated. Before v1.20.0, we have to define several combinations of fieldtag
tag for every UPDATE or INSERT. It's not convenient.
To address this issue, there is a new method WithoutTag
in Struct
to explicitly exclude fields tagged with tags, so that we can simply tag fields as "pk" and call st.WithoutTag("pk").Update("table")
to filter them out. And WithTag
is upgraded to accept more than one tag. With WithTag
and WithoutTag
, we can build a complex struct field filter for all kinds of requirement.
To learn how to use these method, checkout document and samples in Struct
, Struct.WithTag
and Struct.WithoutTag
.
One more thing. All *ForTag
methods in Struct
are deprecated. It's highly recommended to use st.WithTag("tag").Select("table")
to replace st.SelectForTag("table", "tag")
.
Special thanks to @wangmir for your great thoughts and code review feedback.
Full Changelog: v1.19.0...v1.20.0
New feature: Flavor for CQL
We add a new flavor CQL
in this package. See #85 for details. Thanks for your contribution, @SpencerC.
Full Changelog: v1.18.0...v1.19.0
New feature: Flavor for ClickHouse
We add a new flavor ClickHouse
in this package. See #92 for details. Thanks for your contribution, @hanyuancheung.
Full Changelog: v1.17.0...v1.18.0
New feature: Support driver.Valuer in Struct and interpolate methods
Struct and interpolate methods are aware of driver.Valuer
type now. Thank @Sora233 to raise this issue.
Full Changelog: v1.16.0...v1.17.0
New feature: Support "insert ignore" in PostgreSQL and SQLite
New feature: new struct field tag `fieldas` to set set column alias (AS) used in SELECT
Per #78, add a new struct field tag fieldas
to set set column alias (AS) used in SELECT. It can be useful to build SELECT statement, in which columns has alias names, with Struct
.
Full Changelog: v1.14.1...v1.15.0
v1.14.0
- [NEW]
SelectBuilder#GroupBy
andSelectBuilder#OrderBy
works slightly different now. If we call them more than once, they will append columns rather than replace columns. It may be a breaking change. Please let me know if this change breaks any reasonable use case. #74 - [NEW] Add new methods
Struct#Columns
,Struct#ColumnsForTag
,Struct#Values
andStruct#ValuesForTag
. They can be useful when working with sqlmock. #75 - [FIX] Fix small comment typo by @dgellow in #68
- [FIX] Fix warnings and typos by @Serpentiel in #71
- [FIX] Ignore unexported fields that are not embedded structs by @MDobak in #73
Full Changelog: v1.13.0...v1.14.0