Go Sqlbuilder Versions Save

A flexible and powerful SQL string builder library plus a zero-config ORM.

v1.27.0

1 month ago

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: https://github.com/huandu/go-sqlbuilder/compare/v1.26.0...v1.27.0

v1.26.0

1 month ago

What's Changed

  • #140 Feature: New flavor Informix. Thanks for your contribution, @zhangyongding.

Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.25.0...v1.26.0

v1.25.0

5 months ago

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

v1.24.0

5 months ago

What's Changed

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

Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.23.0...v1.24.0

v1.23.0

6 months ago

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: https://github.com/huandu/go-sqlbuilder/compare/v1.22.0...v1.23.0

v1.22.0

9 months ago

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: https://github.com/huandu/go-sqlbuilder/compare/v1.21.0...v1.22.0

v1.21.0

1 year ago

What's Changed

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

Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.20.0...v1.21.0

v1.20.0

1 year ago

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: https://github.com/huandu/go-sqlbuilder/compare/v1.19.0...v1.20.0

v1.19.0

1 year ago

We add a new flavor CQL in this package. See #85 for details. Thanks for your contribution, @SpencerC.

Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.18.0...v1.19.0

v1.18.0

1 year ago

We add a new flavor ClickHouse in this package. See #92 for details. Thanks for your contribution, @hanyuancheung.

Full Changelog: https://github.com/huandu/go-sqlbuilder/compare/v1.17.0...v1.18.0