Commit Graph

1851 Commits

Author SHA1 Message Date
Jinzhu 9acaa33324 Merge pull request #1451 from ModelRocket/master
gorm:auto_preload setting to enable auto preloading associations
2017-05-04 22:08:37 +08:00
Rob Rodriguez e470b44fa8 adding gorm:auto_preload option and related tests 2017-04-27 15:53:39 -07:00
Jinzhu 717654b31c Merge pull request #1420 from ModelRocket/master
Adding more complete binary support for standard dialects
2017-04-19 15:35:50 +08:00
Rob Rodriguez bae0799bd8 Adding better binary type support for common SQL dialects 2017-04-19 00:21:56 -07:00
Jinzhu 08dba5378e Fix typo in tests 2017-04-19 10:17:29 +08:00
Jinzhu a870874bb5 Accept 0 as a value for Limit, Offset 2017-04-18 23:32:31 +08:00
Jinzhu b21c0bef9b Merge pull request #1412 from slayer/master
prevent nil pointer dereference on closed connection
2017-04-18 22:53:27 +08:00
Jinzhu abf1fc7808 Merge pull request #1408 from Konboi/fix/util-to-db-name
Fix ToDBName method
2017-04-18 22:49:33 +08:00
Jinzhu 33aa952d07 Merge pull request #1423 from emil2k/open-tx
Allow open to take transaction.
2017-04-18 22:22:24 +08:00
Emil Davtyan 5ed4c3f290 Allow open to take transaction.
Need to skip the ping, otherwise results in a nil dereference.
2017-04-18 15:33:13 +02:00
Jinzhu 88a47176f3 Use tinyint to int8 2017-04-18 17:16:10 +08:00
Jinzhu 2a041971f9 Change bind var to 24652$ to avoid possible confliction 2017-04-18 16:13:02 +08:00
Jinzhu d7c35d5141 Update issue, pull request template 2017-04-18 15:50:22 +08:00
Jinzhu 848d68aa04 Add issue, pull request template 2017-04-18 15:41:49 +08:00
Jinzhu 5b509264e1 Merge pull request #1438 from tux-mind/master
DB errors over NotFound
2017-04-17 10:34:52 +08:00
tux-mind 1eb3a5ae97 DB errors over NotFound
Errors comings from DB have higher priority than logic ones
2017-04-16 21:15:51 +02:00
Vladislav Moskovets 72a60c5df4 prevent nil pointer dereference on closed connection 2017-03-31 14:26:51 +03:00
Konboi 0493e786b8 Fix ToDBName method
from FiledX > fieldx to FieldX > field_x
2017-03-30 11:48:50 +09:00
Jinzhu 45ccb13437 Merge pull request #1401 from ginodeis/fix-empty-string-order
Fix empty string as order/sort clause
2017-03-27 23:13:47 +08:00
Tino Diaz d03afd173f Fix empty string as order clause 2017-03-26 14:00:34 +01:00
Jinzhu 66d5b42ee9 Add error if exists after parse raw query results, fix #1398 2017-03-24 09:28:06 +08:00
Jinzhu 403487d5dd Setup mssql test env 2017-03-22 23:50:42 +08:00
Jinzhu 5730b92954 Fix tests with mssql 2017-03-22 23:50:42 +08:00
John Mick 66982a7047 Remove SET_IDENTITY_INSERT for transactions in MS SQL
SET_IDENTITY_INSERT should be handled by each individual developer to avoid extra queries to the database.
2017-03-22 23:50:42 +08:00
Jinzhu 572d0a0ab1 Merge pull request #1376 from bt/master
Remove 'sqlite' dialect registration
2017-03-16 22:16:41 +08:00
Jinzhu 8b058a707f Merge pull request #1384 from ansel1/master
Replace all use of *sql.DB with sqlCommon
2017-03-16 22:15:57 +08:00
Russ Egan 45f1a95051 Replace all use of *sql.DB with sqlCommon
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.
2017-03-14 17:02:14 -04:00
Bertram Truong eb6a34b138 Remove 'sqlite' dialect registration 2017-03-05 23:07:12 +11:00
Jinzhu 5409931a1b Merge pull request #1364 from captncraig/mssql-fix
Fix issue with mssql NEXT option.
2017-02-22 08:28:20 +08:00
Craig Peterson c3276eb221 fix issue with mssql NEXT option.
Fixes #1205
2017-02-21 14:23:01 -07:00
Jinzhu 5050a58b45 Merge pull request #1352 from DiSiqueira/small_changes
Fixing 4 typos in comments and gofmt -s in all files
2017-02-12 20:45:29 +08:00
DiSiqueira 2cd7acefc3 Fixing 4 typos in comments and gofmt -s in all files 2017-02-10 16:16:38 -02:00
Jinzhu adf9b80fb7 Refactor format log for postgres 2017-02-10 16:50:55 +08:00
Jinzhu df6c3c9237 Refactor format log for postgres 2017-02-10 16:49:28 +08:00
Jinzhu c730b30a78 Fix "Unsupported destination" error when value is pointer of pointer 2017-02-07 08:32:18 +08:00
Jinzhu b870f86fba Fix set Scanner's data type 2017-02-06 08:43:49 +08:00
Jinzhu 6633f325b8 Fix table name in singular mode in some cases 2017-02-05 18:38:30 +08:00
Jinzhu 1558522aaa Refactor 2017-02-05 15:10:28 +08:00
Jinzhu 23abd03a95 Add error if exists after parse query results 2017-02-02 22:29:41 +08:00
Jinzhu 1092523ce2 Fix check length for Array, Map, Slice 2017-02-02 08:58:28 +08:00
Jinzhu e4b130d2d7 Fix customize DeletedAt's column name 2017-02-01 21:33:36 +08:00
Jinzhu 89f6d74b5e Update isBlank checker 2017-01-25 17:42:15 +08:00
Jinzhu 7fb9b62c17 Apply Before('gorm:row_query') for row query callbacks w/o specify order for compatibility 2017-01-16 09:48:06 +08:00
Jinzhu a3b8b332ed Allow customize data type via ParseFieldStructForDialect 2017-01-15 21:45:17 +08:00
Jinzhu c62e9bcabe Query Row, Rows inside RowQuery callbacks 2017-01-15 18:03:12 +08:00
Jinzhu 97949fdbc1 Refactor Logger 2017-01-15 16:58:55 +08:00
Jinzhu 2c025b25fe Merge pull request #1256 from fobispo-link/master
Issue  #1249 fix - replacing $ placeholders in order when logging
2017-01-15 16:03:52 +08:00
Jinzhu 1aa2d4ca89 Fix primary key for embedded struct 2017-01-09 20:07:39 +08:00
Jinzhu 373207d546 Merge pull request #1304 from gernest/patch-1
Fix *Scope.buildNotCondition
2017-01-05 22:27:20 +08:00
Geofrey Ernest eb0880e710 Fix *Scope.buildNotCondition
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.
2017-01-05 10:38:39 +03:00