Commit Graph

81 Commits

Author SHA1 Message Date
Jinzhu da16a8aac6 Update updated_at when upserting with Create OnConflict 2021-09-17 15:29:49 +08:00
daheige a70254609d optimize setupValuerAndSetter func 2021-07-14 22:03:17 +08:00
heige 50e85e14d4
Code optimize (#4415)
* optimize gormSourceDir replace

* fmt.Errorf adjust and Optimize for-break

* strings trim

* feat: avoid using the same name field and if..else optimization adjustment

* optimization callbacks/create.go Create func if...else logic

* fix: callbacks/create.go Create func

* fix FileWithLineNum func and add gormSourceDir unit test

* remove debug print and utils_filenum_test.go
2021-06-10 10:21:28 +08:00
heige 5555b010dc
feat: Optimal value type acquisition for v (#4278) 2021-04-13 09:41:30 +08:00
gavwu 8cfa9d98f0
Update field.go (#4228)
seems like the `if-else` branch do the same thing, so remove it
2021-04-02 09:56:38 +08:00
yrong1997 2ba612e805
Add field tag to ignore migration (#4028)
* Add field tag to ignore migration

* Fix null value with space

* refactor migration tag
2021-02-09 16:03:02 +08:00
Jinzhu 79864af9ff Allow customize auto increment increment 2020-12-30 11:16:40 +08:00
Jinzhu 6950007d6a Fix failed to parse relations when using goroutinue, close #3790
commit ee0ec43e8dfa85c1c1a562c2d0d47776cf8abd92
Author: Jinzhu <wosmvp@gmail.com>
Date:   Fri Nov 27 14:31:57 2020 +0800

    Fix failed to parse relations when using goroutinue, close #3790

commit 590e73ff95
Author: rokeyzhao <rokeyzhao@tencent.com>
Date:   Thu Nov 26 20:27:55 2020 +0800

    test: no cache preload in goroutine
2020-11-27 14:32:20 +08:00
Jinzhu cb591a7129 Fix panic when using FirstOrCreate with soft delete, close #3671 2020-10-23 18:40:05 +08:00
Jinzhu 3d846957cd Compatible with tag notNull 2020-10-09 17:42:28 +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 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 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 cc6a64adfb Support smart migrate, close #3078 2020-08-23 18:16:12 +08:00
Jinzhu f88e8b072c Check valid pointer before use it as Valuer 2020-08-20 18:13:29 +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
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 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 90a40361ed Fix set bool field from null 2020-07-04 08:21:23 +08:00
Jinzhu 6b98ced13d Fix set time field from null, close #3108 2020-07-04 07:45:07 +08:00
Jinzhu 2476c0fbb4 Set db type after autotime 2020-06-26 07:26:45 +08:00
Jinzhu e77e7bb842 Fix nested embedded field with pointer, close #3071 2020-06-23 09:12:57 +08:00
Jinzhu d4d339f3b5 Handle data type cases 2020-06-19 22:51:46 +08:00
Jinzhu 07960fe661 Fix []byte support 2020-06-18 11:24:08 +08:00
Jinzhu 96368eb967 Test embedded struct implements Scan & Value interface 2020-06-18 09:15:23 +08:00
Jinzhu 6b2f37189e Fix few cases with postgres 2020-06-18 08:40:41 +08:00
Jinzhu a954d772d7 Support customize gorm field type 2020-06-06 10:47:32 +08:00
Jinzhu d50879cc28 Add field permission test 2020-06-05 19:18:22 +08:00
Jinzhu b32658358c Fix can't scan null value into normal data types 2020-06-03 09:00:20 +08:00
Jinzhu 94685d1024 Fix can't scan null value into normal data types 2020-06-02 23:30:26 +08:00