Improved questionmark parameter placeholder replacementw
Added support for subqueries in Where and Having clauses
Queries can be transformed into subqueries by calling .Subquery() on a db object
See main_test.go:TestQueryBuilderSubselectInWhere
Fixed comment spacing
Refactoring, adding Having Subquery support, allowing db.T for tablenames
Removed quoting from tablename in db.T, use db.QT for that
Refactoring, adding Having Subquery support, allowing db.T for tablenames
Added changes
Started with expression extension
Refactoring, adding Having Subquery support, allowing db.T for tablenames
Added method to easily update fields of the Model struct
Added column comparison and Join support
Added subquery support for InnerJoin querybuilder
Fixed column comparison
Added support for column prefixes
Models can set their column prefix by implementing the method ColumnPrefix() string
Fixed multi-parameter subselects and introduced aliasing
Improved Related method
Improved Related method to search for foreign key struct fields with the suffix "ID" (additional to "Id")
Got QueryExpr support from upstream
Added support for subqueries in Where and Having clauses
Queries can be transformed into subqueries by calling .Subquery() on a db object
See main_test.go:TestQueryBuilderSubselectInWhere
Improved questionmark parameter placeholder replacementw
Refactoring, adding Having Subquery support, allowing db.T for tablenames
Removed quoting from tablename in db.T, use db.QT for that
Removed quoting from tablename in db.T, use db.QT for that
Added changes
Added method to easily update fields of the Model struct
Fixed column comparison
Added support for column prefixes
Models can set their column prefix by implementing the method ColumnPrefix() string
Fixed multi-parameter subselects and introduced aliasing
Improved Related method
Improved Related method to search for foreign key struct fields with the suffix "ID" (additional to "Id")
Added select extension for multiple columns
Added support for LEFT RIGHT OUTER joins
Fixed slice support for lexpr.In()
Publizised LExpr
Added DateFormatting for all dialects
Added SUM function for columns
Fixed FormatDate
Added count for column
Removed literal expressions LExpr
Rewrote LExpr methods to work with expr structs.
Added methods BAnd and BOr (bitwise & and | )
Added SetLogWriter method
Added NotIn query expression
Added Distinct query expression
Added DistinctColumn query expression
Same as Distinct but returns a string
Added method OnExp to jexpr
Improved query expression .Eq() method for nil pointers
Fixed rebase errors
Exporting sqlCommon as SQLCommon.
This allows passing alternate implementations of the database connection, or wrapping the connection with middleware. This change didn't change any usages of the database variables. All usages were already only using the functions defined in SQLCommon.
This does cause a breaking change in Dialect, since *sql.DB was referenced in the interface.
gorm.Errors, which usefully implements `error` for an `[]error` as
returned by `DB.GetError()` was already exported, but because it used a
private field `errors`, it was not able to be created due to the
compile-time error:
implicit assignment of unexported field 'errors' in gorm.Errors literal
The trivial solution would be to export the `errors` field on
`gorm.Errors`, but this led to the issue that the common pattern of
checking `err != nil` failed because a struct{error: nil} != nil.
We can take advantage of type aliasing here to make Errors an []error,
which can in fact be nil and would pass `err != nil` on the happy path.
* Remove `(Errors) GetErrors()`, as it's less useful when Errors is an
[]error which can be iterated over. While this is technically a
breaking change, we never expose an Errors and its difficult to build
one (it can be done with the existing `(Errors) Add(error)`), but
awkwardly. This removal can be reverted without issue and we can make
it an identity method, but it seemed an opportune time to reduce API
surface area on something that likely isn't used.
* Remove errorsInterface, as it's not useful without `(Errors)
GetErrors()`
* Change `(*Errors) Add(error)` => `(Errors) Add(error...) Errors`
because we can't modify even a *Errors when it's a type alias. This is
more idiomatic as it follows the pattern of `slice = append(slice,
element)` Go developers are familiar with.