Commit Graph

225 Commits

Author SHA1 Message Date
Jinzhu 39d84cba5f Add serializer support (#5078)
* Update context

* Update GormFieldValuer

* Add Serializer

* Add Serializer Interface

* Refactor gorm field

* Refactor setter, valuer

* Add sync.Pool

* Fix test

* Add pool manager

* Fix pool manager

* Add poolInitializer

* Add Serializer Scan support

* Add Serializer Value method

* Add serializer test

* Finish Serializer

* Fix JSONSerializer for postgres

* Fix JSONSerializer for sqlserver

* Test serializer tag

* Add unixtime serializer

* Update go.mod
2022-02-19 17:02:53 +08:00
li-jin-gou c0bea447b9
fix: omit not work when use join (#5034) 2022-01-28 22:16:42 +08:00
kinggo b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
liweitingwt 24026bf1fe
modify unscoped judge (#4929)
* modify unscoped judge

* modify unscoped judge

Co-authored-by: liweiting <liweiting1995@gmail.com>
2021-12-16 10:41:34 +08:00
kinggo e5bdd610c3
fix: save not use soft_delete (#4897)
* fix: Save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

Co-authored-by: kinggo <>
2021-12-08 13:58:06 +08:00
Jinzhu 300a23fc31 Check rows.Close error, close #4891 2021-12-02 10:39:24 +08:00
Jinzhu 8627634959 Fix create associations with zero primary key, close #4890 2021-12-02 10:20:16 +08:00
Jinzhu 27e2753c9d Fix create duplicated value when updating nested has many relationship, close #4796 2021-11-29 18:43:39 +08:00
Jinzhu e1b4c066a8 Fix FullSaveAssociations, close #4874 2021-11-29 11:02:44 +08:00
heige 9d5f315b6d
feat: go code style adjust and optimize code for callbacks package (#4861)
* feat: go code style adjust and optimize code for callbacks package

* Update scan.go
2021-11-29 09:33:20 +08:00
riverchu 33bc56cbb5 feat(update): update when has SET clause 2021-11-09 19:55:47 +08:00
Jinzhu ca7accdbf6 Fix preload all associations with inline conditions, close #4836 2021-11-08 19:47:10 +08:00
heige 4c8810a848
Refactor if logic (#4683)
* adjust code for preload

* adjust code for Create
2021-11-04 13:45:44 +08:00
kinggo c170af11e9
fix connections leak (#4826)
* fix connections leak

* fix connections leak

* fix connections leak

* fix connections leak

Co-authored-by: 李龙 <lilong.21@bytedance.com>
2021-11-03 13:39:52 +08:00
Jinzhu e953880d19 Add returning tests 2021-10-28 09:17:33 +08:00
Jinzhu 835d7bde59 Add returning support to delete 2021-10-28 07:56:55 +08:00
Jinzhu af3fbdc2fc Improve returning support 2021-10-26 22:40:14 +08:00
Jinzhu b27095e8a1 Refactor Convert SQL null values to zero values for model fields which are not pointers #4710 2021-10-13 21:01:36 +08:00
Jim 19cf645dbd feat: Convert SQL nulls to zero values (ConvertNullToZeroValues)
Makes it the default behavior to convert SQL null values to zero
values for model fields which are not pointers.
2021-10-13 08:11:22 -04:00
kinggo 418c60c83c
fixed: clauseSelect.Columns missed when use Join And execute multiple query. (#4757) 2021-10-09 16:55:45 +08:00
kinggo b46e2afc4a
fix : update miss where's condition when primary key use "<-:create" tag (#4738)
* fix:update miss where condition

* fix:rename test case
2021-10-08 13:47:01 +08:00
Jinzhu da16a8aac6 Update updated_at when upserting with Create OnConflict 2021-09-17 15:29:49 +08:00
Jinzhu a16db07945 Refactor Join ON 2021-09-07 21:21:44 +08:00
Jinzhu ba16b2368f
Refactor update record (#4679) 2021-09-07 20:04:54 +08:00
Adrien Carreira c301aeb524 Refactor for readability 2021-09-06 20:13:20 +08:00
Adrien Carreira 52cc438d07 JoinsOn unit test + use all primary keys 2021-09-06 20:13:20 +08:00
Adrien Carreira 895c1178a0 Proposal, Add Specific on for Joins queries 2021-09-06 20:13:20 +08:00
riverchu eaa63d15e7 feat: copy dest fields to model struct 2021-09-06 20:13:20 +08:00
riverchu 1d9e563023 style: prepose error judgement 2021-09-06 20:13:20 +08:00
Jinzhu 3a8c250180 Refactor calc associations onConflictOption 2021-08-26 13:37:49 +08:00
zkqiang e81833fd11 Fix onConflict with non-updatable in associations 2021-08-26 13:37:49 +08:00
daheige 41ac73b6a1 update comment for ConvertSliceOfMapToValuesForCreate func 2021-07-28 18:56:39 +08:00
heige 5115813c50
Fix preload fmt.Errorf formatter (#4531) 2021-07-28 18:50:08 +08:00
Jinzhu d4f3c109d6 Fix OnConflict with one column, close #4370 2021-07-13 21:29:31 +08:00
Jinzhu 52b72d7ef2 Add error explanations when preloading assocations w/o foreign fields, close #4356 2021-07-13 21:00:13 +08:00
Jinzhu b13732c450 Fix invalid preload SQL when no data found, close #4443 2021-07-13 20:23:05 +08:00
Jinzhu 2ec7043818 Respect update permission for OnConflict Create 2021-07-13 18:04:42 +08:00
Jinzhu 8e67a08774 Fix Scopes with Row, close #4465 2021-06-18 15:38:20 +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
Jinzhu 6951be0284 Allow customize clauses 2021-04-28 17:19:30 +08:00
Jinzhu 7701c88507 Assign transaction error to db 2021-04-16 19:27:23 +08:00
Jinzhu d483ffa45c Fix Preload with nil pointer 2021-04-15 10:37:05 +08:00
heige 74e7a9ca07
Optimize reflect value length and method (#4280)
* Respect ignore migration when add column (#4276)

continue https://github.com/go-gorm/gorm/pull/4028

* feat: Optimal value type acquisition for v (#4278)

* feat: optimize relect value length and value

* feat: optimize ConvertSliceOfMapToValuesForCreate method

Co-authored-by: yrong1997 <yrong1997@gmail.com>
2021-04-14 13:00:54 +08:00
Jinzhu 220349ccf2 Fix omit associations, close #4161 2021-03-19 15:15:26 +08:00
Jinzhu 27bb9137d3 Refactor OnConflict.UpdateALl 2021-03-18 11:44:20 +08:00
Jinzhu 2055e29eb8 Refactor nested preload all associations 2021-03-14 10:42:58 +08:00
ruozhixian c575a4e719 support to preload all children in multiple levels associations 2021-03-11 16:36:49 +08:00
Jinzhu a948c84607 Revert "Revert "Don't override the from clauses, close #4129" close #4139"
This reverts commit d6c23586ae.
2021-03-05 22:19:34 +08:00
Jinzhu d6c23586ae Revert "Don't override the from clauses, close #4129" close #4139
This reverts commit 664755270d.
2021-03-05 19:42:54 +08:00
Sivchari adf85d5b82
change the method of initializing slice (#4097)
* change the method of initializing slice and fixed the length to be specified as 0

* keep the association.go code in the var group

* keep the association.go code in the var group

* change to initializing in var group
2021-03-04 19:44:15 +08:00