Releases: huandu/go-sqlbuilder
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.
`Struct#SelectFrom` and `Struct#SelectFromForTag` add table name as prefix to all columns
Per #40, table name should be added as prefix (like table.col
) to column names to avoid column name conflict. It's useful when building a SELECT
with JOIN
.
Add new methods in `Struct` to support INSERT IGNORE INTO and REPLACE INTO
Per #39, add new methods in Struct
, including InsertIgnoreInto
, ReplaceInto
, InsertIgnoreIntoForTag
and ReplaceIntoForTag
.
New methods to build more complex UPDATE and INSERT INTO
New feature: interpolate `args` in the `sql`
#23 This feature is inspired by the interpolation feature implemented by github.com/go-sql-driver/mysql. It's designed to work with some less functional drivers to bind params to a SQL on client side rather than server side.