26 Commits

Author SHA1 Message Date
Gerhard Gruber
c807fe3202 Started with expression extension
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
2018-02-26 16:00:19 +01:00
Wing Gao
97495a5e40 Add new tag "not_auto_increment" to set a column can auto increase or not 2018-02-10 08:18:35 +08:00
Adrian Heng
48e41440af Allow for proper table creation with Jsonb fields (#1758)
* DataTypeOf should now correctly identify dataValues that are 'json.RawMessage' types as 'jsonb' columns

* move the json check to its own function

* ran gofmt and did some minor tweaks to satisfy CodeClimate
2018-02-09 08:22:30 +08:00
Cedric GESTES
b1885a643b Support cloudsqlpostgres dialect (#1577)
This is needed for proper cloud sql proxy.

see https://github.com/GoogleCloudPlatform/cloudsql-proxy and https://github.com/GoogleCloudPlatform/cloudsql-proxy/blob/master/proxy/dialers/postgres/hook_test.go for details.
2017-09-04 22:39:19 +08:00
Dhiver
981d5db663 Fix postgres dialect UUID sqlType evaluation (#1564) 2017-09-04 22:23:42 +08:00
Lukas Dietrich
750fd9030a Fix postgres dialect for dbs with multiple schemas (#1558)
If a postgres database contains more than one
schema methods like HasTable(...) would return
true even if the current schema does not contain a
table with that name.
2017-09-04 22:22:02 +08:00
Ivan Valkov
5b8c0dd6b9 Changed the type of uint32 from integer to bigint in postgres (#1536)
The integer type in postgres is 4 bytes. Since it is also signed, when using uint32 with high bit set you will get:
`pq: value "2854263694" is out of range for type integer`
To prevent this uint32 should be bigint in postgres.
2017-07-23 16:05:43 +08:00
Rob Rodriguez
bae0799bd8 Adding better binary type support for common SQL dialects 2017-04-19 00:21:56 -07:00
Jinzhu
a3b8b332ed Allow customize data type via ParseFieldStructForDialect 2017-01-15 21:45:17 +08:00
Jinzhu
b507cdf93d Expose current database name API 2016-07-11 21:37:44 +08:00
Jinzhu
bf413d67d3 Merge pull request #959 from vibhavp/master
Fix postgres' HasForeignKey
2016-05-04 21:22:04 +08:00
Jinzhu
c669e4b791 Set AUTO_INCREMENT if field is an auto increment field 2016-05-04 10:37:31 +08:00
Vibhav Pant
e38e096ca0 Fix postgres' HasForeignKey 2016-04-11 18:48:39 +05:30
Jinzhu
55a8e63aad If size haven't been set, use text as string's default type for postgres, close #910 2016-03-16 23:06:27 +08:00
Jinzhu
ec110657da Refactor based on golint 2016-03-07 17:49:55 +08:00
Jinzhu
60a859d966 Add check HasForeignKey method to dialect, also move mssql dialect to a separate repo as it is not well tested, close #832 2016-03-05 22:51:11 +08:00
Jinzhu
b6a2710a15 Don't execute SET IDENTITY_INSERT if dialect is not mssql 2016-03-05 21:24:54 +08:00
Jinzhu
c811590d4e Add dialects for supported databases for easier to use 2016-03-05 18:54:59 +08:00
Jinzhu
4e8370e18b Refactor dialect 2016-02-15 14:59:15 +08:00
Jinzhu
f4456e139e Register dialects 2016-02-14 18:06:42 +08:00
Jinzhu
b4abd125c1 Refactor DataTypeOf for postgres, mssql 2016-02-14 13:51:34 +08:00
Jinzhu
552d9bf455 Refactor DataTypeOf for sqlite 2016-02-14 11:51:53 +08:00
Jinzhu
2dfd76d22b Refactor DataTypeOf 2016-01-29 15:08:53 +08:00
Jinzhu
d92c5db9e7 Refactor dialect 2016-01-19 13:11:11 +08:00
Jinzhu
e159ca1914 Refactor dialect 2016-01-18 20:32:52 +08:00
Jinzhu
09f46f01b9 Refactor dialect 2016-01-16 22:01:04 +08:00