Skip to content

Releases: huandu/go-sqlbuilder

New feature: New builder `WhereClause` dedicated for WHERE clause

15 Apr 04:12
c6a9ca2
Compare
Choose a tag to compare

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!

What's Changed

  • #147 [NEW] WhereClause: A new dedicated builder for WHERE. Thanks for raising this idea to me in #145, @LeDuyViet.
  • #146 Optimize paging syntax for Informix flavor SQL. Thanks, @zhangyongding.

Full Changelog: v1.26.0...v1.27.0

New feature: Support Informix SQL

31 Mar 05:00
c35040f
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.25.0...v1.26.0

New feature: Return number of required clause in builders

11 Dec 14:47
Compare
Choose a tag to compare

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: v1.24.0...v1.25.0

New feature: Support `INSERT INTO ... SELECT` statement

20 Nov 10:34
eb77f78
Compare
Choose a tag to compare

What's Changed

  • #133 Add sub-select builder for InsertBuilder to support INSERT INTO ... SELECT statement. Thanks, @cemremengu.

Full Changelog: v1.23.0...v1.24.0

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