Evan Owen
4b91437c88
Treat partially zero compound foreign keys as an unset association
...
Currently when one value of a compound foreign key is null or zero,
preloading this association yields a panic ("reflect: call of
reflect.Value.Interface on zero Value") because we're attempting to
look up the identity values when any one of the columns is non-zero.
The fix here is to require each of the values to be non-zero or we
assume that the association is missing. This is not a very common
scenario to have in practice, but it's an edge case that's easy to fix
and resolves a use-case for me.
2020-11-02 19:04:55 -08:00
Jinzhu
cb591a7129
Fix panic when using FirstOrCreate with soft delete, close #3671
2020-10-23 18:40:05 +08:00
Jinzhu
5fee5b1b24
Add option tag support for index
2020-10-21 20:18:21 +08:00
Jinzhu
3d846957cd
Compatible with tag notNull
2020-10-09 17:42:28 +08:00
Jinzhu
a2faa41cbe
Refactor NamingStrategy, close #3540
2020-09-28 10:55:27 +08:00
Jinzhu
ba253982bf
Fix Pluck with Time and Scanner
2020-09-24 20:08:24 +08:00
Jinzhu
1a526e6802
Fix NamingStrategy with embedded struct, close #3513
2020-09-24 11:32:38 +08:00
Jinzhu
ed1b134e1c
Fix use uint to for autoCreateTime, autoUpdateTime
2020-09-11 17:33:31 +08:00
Jinzhu
b8a74a80d7
Fix embedded struct with default value, close #3451
2020-09-11 11:18:54 +08:00
Jinzhu
231effe119
Fix parse blank default value, close #3442
2020-09-10 11:59:18 +08:00
Jinzhu
f6ed895caf
Build relationships if fields are not ignored, fix #3181
2020-09-09 16:37:05 +08:00
Jinzhu
6e38a2c2d5
Fix many2many join table name rule
2020-09-06 10:51:21 +08:00
Jinzhu
f121622228
Don't add prefix for invalid embedded fields
2020-09-04 14:35:44 +08:00
Jinzhu
6a86646469
Fix use db function as integer's default value, close #3384
2020-09-03 20:41:00 +08:00
Jinzhu
78e9c9b748
raise error when failed to parse default value, close #3378
2020-09-03 18:20:57 +08:00
Jinzhu
f2adb088c5
Set field size from primary fields to foreign fields
2020-09-03 16:11:15 +08:00
Jinzhu
dbe0f4d8d7
Allow use NULL as default value for string, close #3363
2020-09-02 20:15:12 +08:00
aimuz
9a101c8a08
fmt.Sprint() to strconv.Format ( #3354 )
2020-09-01 21:03:37 +08:00
Jinzhu
162367be7d
Fix multiple M2M relations on one table, close #3347
2020-09-01 11:30:16 +08:00
Jinzhu
53f8c9fc1c
More compatible prioritized primary field #3156
2020-08-30 20:58:14 +08:00
Jinzhu
c19a3abefb
Fix self-referential belongs to, close #3319
2020-08-28 11:31:13 +08:00
Jinzhu
ce8853e7a6
Add GormValuer interface support
2020-08-27 15:03:57 +08:00
Jinzhu
0f3201e73b
friendly invalid field error message
2020-08-25 18:18:16 +08:00
Jinzhu
cc6a64adfb
Support smart migrate, close #3078
2020-08-23 18:16:12 +08:00
Jinzhu
2b510d6423
Don't create index for join table, close #3294
2020-08-21 15:40:50 +08:00
Jinzhu
f88e8b072c
Check valid pointer before use it as Valuer
2020-08-20 18:13:29 +08:00
Jinzhu
06de6e8834
Test same field name from embedded field, close #3291
2020-08-20 10:58:35 +08:00
Jinzhu
3313c11888
Fix embedded struct containing field named ID, close #3286
2020-08-19 19:15:27 +08:00
Jinzhu
c1782d60c1
Fix embedded scanner/valuer, close #3283
2020-08-19 15:47:08 +08:00
Jinzhu
dc48e04896
Fix nested embedded struct, close #3278
2020-08-18 11:21:40 +08:00
Jinzhu
681268cc43
Refactor Create/Query/Update/DeleteClauses interface
2020-08-17 16:31:09 +08:00
Jinzhu
6834c25cec
Fix stack overflow for embedded self-referred associations, close #3269
2020-08-17 12:02:46 +08:00
Jinzhu
7d45833f3e
Fix driver.Valuer interface returns nil, close #3248
2020-08-13 12:05:55 +08:00
Jinzhu
a3dda47afa
Don't parse ignored anonymous field
2020-08-13 10:23:23 +08:00
Jinzhu
ff985b90cc
Fix failed to guess relations for embedded types, close #3224
2020-08-04 12:25:34 +08:00
Jinzhu
f83b00d20d
Fix Count with Select when Model not specfied, close #3220
2020-08-03 10:30:25 +08:00
Jinzhu
2676fa4fb8
Remove autoincrement tag for join table, close #3217
2020-07-31 18:19:25 +08:00
lninl
7bb883b665
Auto creating/updating time with unix (milli) second ( #3213 )
...
* Auto creating/updating time with unix (milli) second
* add test for 'Auto creating/updating time with unix (milli) second'
2020-07-30 17:39:57 +08:00
Jinzhu
47a5196734
Fix uninitialized Valuer return time.Time, close #3214
2020-07-30 17:37:07 +08:00
Jinzhu
7c2ecdfc1c
Fix use pointer of Valuer as foreign key, close #3212
2020-07-30 10:23:35 +08:00
Jinzhu
2cbdd29f26
Returns error for invalid embedded field, close #3209
2020-07-29 10:23:14 +08:00
Jinzhu
7021db3655
Fix FieldsWithDefaultDBValue for primary field, close #3187
2020-07-22 19:03:19 +08:00
Jinzhu
ef002fd7ac
Add GORMDataType to Field, close #3171
2020-07-20 19:00:03 +08:00
Jinzhu
6dc583869b
Don't use value's first field to guess data type for struct implements GormDataTypeInterface
2020-07-17 12:02:00 +08:00
Jinzhu
4456df7a5d
Lint with golangci-lint
2020-07-16 11:27:12 +08:00
Jinzhu
0028246ea5
Don't set DefaultValueInterface when DefaultValue not set, close #3152
2020-07-16 10:19:24 +08:00
Jinzhu
bc3728a18f
Fix concurrent map writes, close #3126
2020-07-10 07:14:37 +08:00
Jinzhu
2ae0653af2
Fix ambiguous column when using same column name in join table, close #3120
2020-07-09 09:03:48 +08:00
Jinzhu
e1084e78d0
Allow customize AutoIncrement for primary field
2020-07-08 18:50:49 +08:00
Jinzhu
619cd332ec
Add index priority supports
2020-07-08 17:59:40 +08:00