Commit Graph

44 Commits

Author SHA1 Message Date
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
Jinzhu 3cbd233758 Add more tests for parse schema relations 2020-02-02 00:03:56 +08:00
Jinzhu a4a0895a85 Test parse schema relations 2020-02-01 22:26:17 +08:00
Jinzhu 14724ddeae Add tests model definition and basic fields tests 2020-02-01 20:18:32 +08:00
Jinzhu eea78f3f30 Implement parse relationship architecture 2020-02-01 12:46:52 +08:00
Jinzhu 010dc7e6dd Add namer when generate schema 2020-01-31 14:31:15 +08:00
Jinzhu 1079e17caf Implement schema parser 2020-01-31 12:46:16 +08:00