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
* Correct ModifyColumn SQL syntax.
The generated SQL for ModifyColumn was:
`ALTER TABLE "tablename" MODIFY "columname" type`
But should have been:
`ALTER TABLE "tablename" ALTER COLUMN "columname" TYPE type`
since Modify does not seem to be entirely compatible with all Engines
* Test ModifyColumn
* Skip ModifyColumnType test on incompatible DBs
Some DB Engines don't fully support alter table so we skip
when the dialect does not correspond to one of the ones that
are known to support it.
* Updated scope.go to always quote when adding index
I am using numbers for column names (to be compatible with protobuf) and adding unique index to them does not work since they are not quoted. I do not see a reason to check if the column name is a string in order to quote it. Correct me if I am wrong.
* Updated the columnRegexp to include decimals
* Update scope.go
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.
this fixes the logic of handling empty slice of int family in a query i.e something linke `[]int64{}`
This code snipped doesn't look like it was intended to be this way
```
if reflect.ValueOf(value).Len() > 0 {
str = fmt.Sprintf("(%v.%v NOT IN (?))", scope.QuotedTableName(), scope.Quote(primaryKey))
clause["args"] = []interface{}{value}
}
return ""
```
The `return ""` is always guaranteed to be executed regardless of whether the length of value is greater than 0. I believe the intended behavior is to return `""` when the length of value is zero.