Skip to content

Releases: huandu/go-sqlbuilder

New feature: Support new flavor `Oracle`

04 Nov 06:52
Compare
Choose a tag to compare

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

22 Jul 15:23
18c5787
Compare
Choose a tag to compare

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

01 Apr 09:06
20d1fd8
Compare
Choose a tag to compare

What's Changed

  • #98: Add new flavor Presto.
  • #100: Add EXISTS/NOT EXISTS/ANY/SOME/ALL in Cond.

Full Changelog: v1.20.0...v1.21.0

New feature: Filter struct fields using WithTag and WithoutTag

27 Feb 03:13
71a8512
Compare
Choose a tag to compare

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

12 Jan 12:47
Compare
Choose a tag to compare

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

15 Dec 08:12
Compare
Choose a tag to compare

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

24 Nov 08:47
f299327
Compare
Choose a tag to compare

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

22 Sep 02:04
167e2ad
Compare
Choose a tag to compare

Per #87, add new methods on InsertBuilder and Flavor to build "insert ignore" statement for all supported flavors. Thanks, @zhongr3n.

New feature: new struct field tag `fieldas` to set set column alias (AS) used in SELECT

24 Jul 02:00
a283436
Compare
Choose a tag to compare

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

25 Jun 07:22
Compare
Choose a tag to compare
  • [NEW] SelectBuilder#GroupBy and SelectBuilder#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 and Struct#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