Commit Graph

56 Commits

Author SHA1 Message Date
Cr d9525d4da4
fix: skip append relation field to default db value (#5885)
* fix: relation field returning

* chore: gofumpt style
2022-12-01 20:26:59 +08:00
Jinzhu 34fbe84580 Add TableName with NamingStrategy support, close #5726 2022-10-07 21:18:37 +08:00
Nguyen Huu Tuan 328f301982
add some test case which related the logic (#5477) 2022-09-22 18:35:21 +08:00
MJrocker 3c6eb14c92 Fixed some typos in the code comment 2022-07-27 10:22:49 +08:00
Jinzhu 5daa413f41 Stabilize schema.FieldsWithDefaultDBValue's order, close #4643 2021-11-08 20:20:55 +08:00
Jason Lee d3211908a0
Refactor ParseWithSchemaTable method and improve test. (#4789)
* Refactor ParseWithSchemaTable method and improve test.

* Fix schema.ParseWithSchemaTable method for only use schemaTable in migrator and improve test.

* Rename `schemaTable` to `specialTableName` for clearly argument.
2021-10-25 11:26:44 +08:00
Wendell Sun a3bd9c3ea2 fix: automigrate error caused by indexes while using dynamic table name 2021-10-19 09:59:57 +08:00
kinggo ec58e3319f
fixed:panic when create value from nil struct pointer. (#4771)
* fixed:create nil pointer

* fixed:panic when create value from nil struct pointer.
2021-10-12 21:19:08 +08:00
Jinzhu 12bbde89e6 Fix Scan with interface 2021-09-17 14:04:19 +08:00
Jinzhu 6c94b07e98 try to fix fatal error: concurrent map read and map write 2021-09-07 15:30:14 +08:00
daheige 7a49629fd1 optimize Parse func for fieldValue.Interface 2021-07-28 19:00:34 +08:00
Burak Demirpolat 0329b800b0
slightly better callback warning (#4495) 2021-07-13 16:38:44 +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
Chen Quan a480bd8545
Update Optimize schema (#4364) 2021-05-10 09:51:50 +08:00
Jinzhu deff0594ee Save associations based on creatable/updatable permission, close #4056 2021-02-07 14:24:11 +08:00
Jinzhu f655041908 Allow overwrite ignored field's permission, close #3829 2020-12-06 11:07:05 +08:00
Andy Bursavich 61d3a4d6ea
Fix schema initialization paths (#3825)
* Fix schema initialization paths

The initialized channel was only closed if the schema's cacheStore did not contain the embeddedCacheKey and there were no errors parsing relations.  If the key existed or an error occurred, it would not be closed. This could leave other goroutines waiting for synchronization that will never occur.

Additionally, the other code paths that wait for initialization to complete did not return the possible error.

* Unnest common schema initialization

This makes the common code path less deeply nested and the flow control easier to follow.
2020-12-04 11:28:38 +08:00
Jinzhu 0f77500917 Waiting for schema to be initialized, close #3790 2020-11-27 17:05:45 +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 1e241aa645 Reduce GC alloc 2020-11-10 21:23:20 +08:00
Jinzhu 1a526e6802 Fix NamingStrategy with embedded struct, close #3513 2020-09-24 11:32:38 +08:00
Jinzhu f6ed895caf Build relationships if fields are not ignored, fix #3181 2020-09-09 16:37:05 +08:00
Jinzhu 53f8c9fc1c More compatible prioritized primary field #3156 2020-08-30 20:58:14 +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 f83b00d20d Fix Count with Select when Model not specfied, close #3220 2020-08-03 10:30:25 +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 bc3728a18f Fix concurrent map writes, close #3126 2020-07-10 07:14:37 +08:00
Jinzhu e1084e78d0 Allow customize AutoIncrement for primary field 2020-07-08 18:50:49 +08:00
Hinagiku Soranoba b733d16f56
Create supports Array / ArrayPtr (#3076)
* add Array / ArrayPtr create tests

* support create using array
2020-06-23 14:38:36 +08:00
Jinzhu a1e35bdc94 Support merge batch data some having primary values 2020-06-20 16:52:15 +08:00
Jinzhu a954d772d7 Support customize gorm field type 2020-06-06 10:47:32 +08:00
Jinzhu 1490a062db Refactor codebase and add benchmark test 2020-06-05 23:26:56 +08:00
Jinzhu 2218e32999 Allow customize table name with TableName 2020-06-02 15:48:19 +08:00
Jinzhu e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu befef0c9a9 Improve Hooks 2020-06-01 00:12:20 +08:00
Jinzhu 55074213bc Add SoftDelete support 2020-05-29 07:35:45 +08:00
Jinzhu 5d9b57cc4e Test HasMany Association 2020-05-25 11:11:09 +08:00
Jinzhu e60a8d54ff Test Nested Preload 2020-05-24 00:52:25 +08:00
Jinzhu 922a8efc53 Generate Query Conds for Relationship 2020-05-19 21:50:06 +08:00
Jinzhu 59365b776b Refacotr Preload 2020-05-18 13:07:11 +08:00
Jinzhu 8def7be583 Add context to logger 2020-05-05 21:28:38 +08:00
Jinzhu 04adbaf7f6 Fix parse stmt ReflectValue 2020-02-24 08:51:35 +08:00
Jinzhu e2a360b9fa Add Before/After callbacks 2020-02-23 21:22:35 +08:00
Jinzhu fa22807e12 Make inesrt into db works 2020-02-23 19:41:29 +08:00
Jinzhu 43ce0b8af2 Handle create with default db values 2020-02-20 10:13:26 +08:00
Jinzhu cbbf8f3d49 Update schema 2020-02-18 22:56:37 +08:00
Jinzhu 2cb88dc7c5 Add Field Valuer, Setter 2020-02-15 18:24:37 +08:00
Jinzhu d833efe8b9 Work on clauses 2020-02-02 19:11:17 +08:00