Skip to content

Releases: huandu/go-sqlbuilder

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

New feature: Add a new flavor SQLServer

07 Sep 03:03
153aee0
Compare
Choose a tag to compare

Per request in #64, SQL builder can build query for SQL Server now.

New feature: Field mapper function

21 Feb 12:32
Compare
Choose a tag to compare

Per #59, new APIs around field mapper functions are added.

In many production environments, table column names are usually snake_case words, e.g. user_id, while we have to use CamelCase in struct types to make struct fields public and golint happy. It's a bit redundant to use the db tag in every struct field. If there is a certain rule to map field names to table column names, We can use field mapper function to make code simpler.

See field mapper function sample as a demo.

New Feature: New method `SQL` in all pre-defined builders

03 Feb 16:21
116009b
Compare
Choose a tag to compare

There is a method SQL(sql string) implemented by all statement builders like SelectBuilder. We can use this method to insert any arbitrary SQL fragment when building a SQL. It's quite useful to build SQL containing non-standard syntax supported by a OLTP or OLAP system.

See README.md for more details.

New feature: SQLite support

26 Dec 16:14
Compare
Choose a tag to compare

SQLite flavor is added. Try it and let me know your feedback.

New feature: new field option `omitempty(tag1,tag2,...)`

02 Nov 09:05
Compare
Choose a tag to compare

The omitempty field option is upgraded to a function which can omit a field for one or more tags.

See #50 for details.

New feature: Support `Union` and `UnionAll`

28 Jul 04:09
Compare
Choose a tag to compare

Per #47, new methods Union and UnionAll are added to support UNION [ALL | DISTINCT] operators.