- [FEATURE] Add support for aliasing insert datasets to support upsert alias #306 - @XIELongDragon
- [FEATURE] Add support for aliasing BooleanExpressions #307 - @XIELongDragon
- [FEATURE] Add support bitwise operations #303 - @XIELongDragon
- [FEATURE] Add support for specifying tables to be locked in ForUpdate, ForNoKeyUpdate, ForKeyShare, ForShare #299 - @jbub
- [FEATURE] GroupByAppend to the SelectDataset and SelectClauses #276, #287 - @ashishkf
- [FEATURE] Allow untagged fields to be ignored #285 - @Deiz
- [FIX] Nil valuer #277 - @benzolium, @Diggs
- [FIX] Fix old import URL in doc comments #286 - @maito1201
- Update golangci-lint and updates for all associated linters
- Update dependencies
- github.com/DATA-DOG/go-sqlmock v1.3.3 -> v1.5.0
- github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e -> v0.10.0
- github.com/go-sql-driver/mysql v1.4.1 -> v1.6.0
- github.com/lib/pq v1.2.0 -> v1.10.1
- github.com/mattn/go-sqlite3 v1.11.0 -> v1.14.7
- github.com/stretchr/testify -> v1.4.0 -> v1.7.0
- [FIXED] Avoid mutation of join slice for separate datasets when joins slice capacity is not yet reached #261 - @fhaifler
- [FIXED] Use valid 'IS' operator for sqlserver dialect #240, #239 - @vlanse
- [ADDED] Implement Orderable interface for SQL Functions #251 - @GlebBeloded
- [ADDED] Support for table hint in multi-table MySQL DELETE queries #252 - @vlanse
- [FIXED] SELECT inherits dialect from INSERT in INSERT FROM SELECT. #229, #223 - @vlanse
- [FIXED] SQLServer dialect: support prepared statements with TOP. #230, #225 - @vlanse
- [ADDED] IsPrepared to SQLExpression interface. #231 - @vlanse
- [FIXED] SQLite do not add FOR UPDATE in SELECT. #218 - @vlanse
- [ADDED] Support for INSERT ON CONFLICT in SQLite. #218 - @vlanse
- [ADDED] Support for ANY and ALL operators. #196
- [ADDED] Support for CASE statements #193
- [ADDED] Support for getting column identifiers from AliasExpressions. #203
- Fix all formatting for golangci-lint
- Move to golangci-lint github action
- [ADDED] Support for Lateral queries #182
- [FIXED] WITH clause without a RETURNING clause will panic #177
- [FIXED] SQlite dialect escapes single quotes wrong, leads to SQL syntax error #178
- [FIXED] Fix ReturnsColumns() nil pointer panic #181 - @yeaha
- [FIXED] SelectDataset From with Error #183
- [FIXED] Unable to execute union with order by expression #185
- [ADDED] Ability to use regexp like, ilike, notlike, and notilike without a regexp #172
- [ADDED] Ability to scan into struct fields from multiple tables #160
- [ADDED] Using Update, Insert, or Delete datasets in sub selects and CTEs #164
- [FIXED] Issue where
NULL
,TRUE
andFALSE
are interpolated when using anIS
clause. #165
- Changed
NULL
,TRUE
,FALSE
to not be interpolated when creating prepared statements. #132, #158 - @marshallmcmullen - Updated dependencies
github.com/lib/pq v1.1.1 -> v1.2.0
github.com/mattn/go-sqlite3 v1.10.0 -> v1.11.0
github.com/stretchr/testify v1.3.0 -> v1.4.0
- [ADDED]
SetError()
andError()
to all datasets. #152 and #150 - @marshallmcmullen
- [FIXED] Returning func be able to handle nil #140
- Created new
sqlgen
module to encapsulate sql generation- Broke SQLDialect inti new SQL generators for each statement type.
- Test refactor
- Moved to a test case pattern to allow for quickly adding new test cases.
- [FIXED] InsertDataset.WithDialect return old dataset #126 - @chen56
- Test clean up and more testing pattern consistency
- Changed to use assertion methods off of suite
- Updated Equals assertions to have expected output first
- Increase overall test coverage.
- [Added] Support for
DISTINCT ON
clauses #119
- [FIX] Scanner errors on pointers to primitive values #122
- [FIX] Return an error when an empty identifier is encountered #115
- [FIX] Fix reflection errors related to nil pointers and unexported fields #118
- Unexported fields are ignored when creating a columnMap
- Nil embedded pointers will no longer cause a panic
- Fields on nil embedded pointers will be ignored when creating update or insert statements.
- [ADDED] You can now ingore embedded structs and their fields by using
db:"-"
tag on the embedded struct.
- [ADDED] Support column DEFAULT when inserting/updating via struct #27
- [ADDED] Multi table update support for
mysql
andpostgres
#60 - [ADDED]
goqu.V
so values can be used on the LHS of expressions #104
A major change the the API was made in v8
to seperate concerns between the different SQL statement types.
Why the change?
- There were feature requests that could not be cleanly implemented with everything in a single dataset.
- Too much functionality was encapsulated in a single datastructure.
- It was unclear what methods could be used for each SQL statement type.
- Changing a feature for one statement type had the possiblity of breaking another statement type.
- Test coverage was decent but was almost solely concerned about SELECT statements, breaking them up allowed for focused testing on each statement type.
- Most the SQL generation methods (
ToInsertSQL
,ToUpdateSQL
etc.) took arguments which lead to an ugly API that was not uniform for each statement type, and proved to be inflexible.
What Changed
There are now five dataset types, SelectDataset
, InsertDataset
, UpdateDataset
, DeleteDataset
and TruncateDataset
Each dataset type has its own entry point.
goqu.From
,Database#From
,DialectWrapper#From
- Create SELECTgoqu.Insert
,Database#Insert
,DialectWrapper#Insert
- Create INSERTgoqu.Update
,Database#db.Update
,DialectWrapper#Update
- Create UPDATEgoqu.Delete
,Database#Delete
,DialectWrapper#Delete
- Create DELETEgoqu.Truncate
,Database#Truncate
,DialectWrapper#Truncate
- Create TRUNCATE
ToInsertSQL
, ToUpdateSQL
, ToDeleteSQL
, and ToTruncateSQL
(and variations of them) methods have been removed from the SelectDataset
. Instead use the ToSQL
methods on each dataset type.
Each dataset type will have an Executor
and ToSQL
method so a common interface can be created for each type.
- [FIXED] literalTime use t.UTC() , This behavior is different from the original sql.DB #106 - chen56
- [ADDED] Add new method WithTx for Database #108 - Xuyuanp
- [ADDED] Exposed
goqu.NewTx
to allow creating a goqu tx directly from asql.Tx
instead of usinggoqu.Database#Begin
#95 - [ADDED]
goqu.Database.BeginTx
#98
- [ADDED] UPDATE and INSERT should use struct Field name if db tag is not specified #57
- [CHANGE] Changed goqu.Database to accept a SQLDatabase interface to allow using goqu.Database with other libraries such as
sqlx
#95
- [FIXED] Sqlite3 does not accept SELECT * UNION (SELECT *) #79
- [FIXED] Where(Ex{}) causes panics [mysql] #49
- [ADDED] Support for OrderPrepend #61
- [DOCS] Added new section about loading a dialect and using it to build SQL #44
- [FIXED] Embedded pointers with property names that duplicate parent struct properties. #23
- [FIXED] Can't scan values using []byte or []string #90
- When a slice that is
*sql.RawBytes
,*[]byte
orsql.Scanner
no errors will be returned.
- When a slice that is
Linting
- Add linting checks and fixed errors
- Renamed all snake_case variables to be camelCase.
- Fixed examples to always map to a defined method
- Renamed
adapters
todialect
to more closely match their intended purpose.
API Changes
- Updated all sql generations methods to from
Sql
toSQL
ToSql
->ToSQL
ToInsertSql
->ToInsertSQL
ToUpdateSql
->ToUpdateSQL
ToDeleteSql
->ToDeleteSQL
ToTruncateSql
->ToTruncateSQL
- Abstracted out
dialect_options
from the adapter to make the dialect self contained.- This also removed the dataset<->adapter co dependency making the dialect self contained.
- Refactored the
goqu.I
method.- Added new
goqu.S
,goqu.T
andgoqu.C
methods to clarify why type of identifier you are using. goqu.I
should only be used when you have a qualified identifier (e.g. `goqu.I("my_schema.my_table.my_col")
- Added new
- Added new
goqu.Dialect
method to make usinggoqu
as an SQL builder easier.
Internal Changes
- Pulled expressions into their own package
- Broke up expressions.go into multiple files to make working with and defining them easier.
- Moved the user facing methods into the main
goqu
to keep the same API as before.
- Added more examples
- Moved non-user facing structs and interfaces to internal modules to clean up API.
- Increased test coverage.
- Handle nil *time.Time Literal #73 and #52 - @RoarkeRandall and @quetz
- Add ability to change column rename function #66 - @blainehansen
- Updated go support to
1.10
,1.11
and1.12
- Change testify dependency from c2fo/testify back to stretchr/testify.
- Add support for "FOR UPDATE" and "SKIP LOCKED" #62 - @btubbs
- Changed to use go modules
- Prepared(true) issues when using IS NULL comparisson operation #33 - @danielfbm
- Add
upsert
support viaInsertIgnore
andInsertConflict
methods - #25 - @aheuermann - Adding vendor dependencies and updating tests to run in docker containers #29 - @aheuermann
- Add range clauses ([NOT] BETWEEN) support - #25 - @denisvm
- Readmefix #26 - @tiagopotencia
- Fixing race condition with struct_map_cache in crud_exec #18 - @andymoon, @aheuermann
- Version 3.1 #14 - @andymoon
- Fix an issue with a nil pointer access on the inserts and updates.
- Allowing ScanStructs to take a struct with an embedded pointer to a struct.
- Change to check if struct is Anonymous when recursing through an embedded struct.
- Updated to use the latest version of github.com/DATA-DOG/go-sqlmock.
- Add literal bytes and update to c2fo testify #15 - @TechnotronicOz
- Fixed issue with transient columns and the auto select of columns.
- Changed references to "github.com/doug-martin/goqu" to "gopkg.in/doug-martin/goqu.v2"
- Fixed issue when
ScanStruct(s)
was used withSelectDistinct
and caused a panic.
- When scanning a struct or slice of structs, the struct(s) will be parsed for the column names to select. #9 - @technotronicoz
- You can now passed an IdentiferExpression to
As
#8 - @croachrose - Added info about installation through gopkg.in
- Fixed issue setting Logger when starting a new transaction.
- Changed sql generation methods to use a common naming convention.
To(Sql|Insert|Update|Delete)
- Also changed to have common return values
string, []interface{}, error)
- Also changed to have common return values
- Added
Dataset.Prepared
which allows a user to specify whether or not SQL should be interpolated. #7 - Updated Docs
- More examples
- Increased test coverage.
- Changed
CrudExec
to not wrap driver errors in a GoquError #2 - Added ability to use a dataset in an
Ex
map orEq
expression without having to useIn
#3db.From("test").Where(goqu.Ex{"a": db.From("test").Select("b")})
- Updated readme with links to
DefaultAdapter
- Added:
- More tests and examples
- Added CONTRIBUTING.md
- Added LICENSE information
- Removed godoc introduction in favor of just maintaining the README.
- Fixed issue with goqu.New not returning a pointer to a Database
- Initial release