Releases: huandu/go-sqlbuilder
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
New feature: Add a new flavor SQLServer
Per request in #64, SQL builder can build query for SQL Server now.
New feature: Field mapper function
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
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
SQLite
flavor is added. Try it and let me know your feedback.
New feature: new field option `omitempty(tag1,tag2,...)`
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`
Per #47, new methods Union
and UnionAll
are added to support UNION [ALL | DISTINCT]
operators.