Commit Graph

123 Commits

Author SHA1 Message Date
black-06 32045fdd7d
feat: unscoped association (#5899) (#6246)
* feat: unscoped association (#5899)

* modify name because mysql character is latin1

* work only on has association

* format

* Unscoped on belongs_to association
2023-05-04 19:30:45 +08:00
black-06 42fc75cb2c
fix: association concurrently appending (#6044)
* fix: association concurrently appending

* fix: fix unit test

* fix: fix gofumpt
2023-02-18 09:19:24 +08:00
Goxiaoy 2ba599e8b7
fix empty QueryClauses in association (#5502) (#5503)
* fix empty QueryClauses in association (#5502)

* test: empty QueryClauses in association (#5502)

* style: empty QueryClauses in association (#5502)

* style: empty QueryClauses in association (#5502)
2022-07-15 11:15:18 +08:00
Goxiaoy cd0315334b
fix: context missing in association (#5214) 2022-04-01 08:33:39 +08:00
Cr 3d7019a7c2
fix: throw err if association model miss primary key (#5187) 2022-03-24 09:34:06 +08:00
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
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 495ec4bd87
invalid db error and value and invalid value length error (#4151) 2021-03-07 10:56:32 +08:00
Jinzhu 7598204dc3 Support `FullSaveAssociations` for association mode, close #4010 2021-01-29 16:55:26 +08:00
Jinzhu 08678106a4 Support replace associations without the creation in association mode, close #3937 2021-01-26 14:34:21 +08:00
Jinzhu ad8a5c0d1a Add QueryFields mode when query many2many relations 2020-12-25 16:35:25 +08:00
Deviller d66af581b4
Fix Association.Replace() error returning (#3766)
* Fix Association.Replace() error returning

* Fallback to gorm.Model at TestAssociationNotNullClear()
2020-11-19 19:24:34 +08:00
Jinzhu 26504f5cae Use NewDB to replace WithConditions for Session 2020-11-17 16:28:37 +08:00
Jinzhu b4166d9515 Fix V2 Save compatibility, close #3332 2020-08-30 10:21:11 +08:00
Jinzhu 94c6bb980b Refactor association 2020-08-28 17:32:19 +08:00
Jinzhu c19a3abefb Fix self-referential belongs to, close #3319 2020-08-28 11:31:13 +08:00
Qt f4cfa9411b
define err with the same code style (#3199) 2020-07-26 10:03:58 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +08:00
Jinzhu 1f05cb7e55 Handle Associations with pointer of pointer, close #3130 2020-07-10 22:53:03 +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 e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu e490e09db5 Add SetupJoinTable support 2020-06-01 23:58:22 +08:00
Jinzhu 1559fe24e5 Add more updates test 2020-06-01 19:41:33 +08:00
Jinzhu 55074213bc Add SoftDelete support 2020-05-29 07:35:45 +08:00
Jinzhu c299cb8db6 Refactor association 2020-05-26 11:19:01 +08:00
Jinzhu 8de2bb4eab Test single table many2many association 2020-05-26 01:57:22 +08:00
Jinzhu 457f1e5d73 Test Many2Many Association for Slice 2020-05-26 01:21:15 +08:00
Jinzhu dea48a8c59 Test Many2Many Association 2020-05-26 00:16:44 +08:00
Jinzhu 135d9f8b03 Test HasMany Association for Slice 2020-05-25 11:57:58 +08:00
Jinzhu 5d9b57cc4e Test HasMany Association 2020-05-25 11:11:09 +08:00
Jinzhu 91eaf0bb21 Test HasOne Association for Slice 2020-05-24 23:43:42 +08:00
Jinzhu 6a0ef985ff Test Polymorphic HasOne Association 2020-05-24 23:28:06 +08:00
Jinzhu 68a7a8207a Test HasOne Association 2020-05-24 23:07:42 +08:00
Jinzhu 677c745b62 Test shared association 2020-05-24 21:46:53 +08:00
Jinzhu 2db33730b6 Add Slice Association for BelongsTo 2020-05-24 20:53:20 +08:00
Jinzhu 91a695893c Test Association For BelongsTo 2020-05-24 18:33:15 +08:00
Jinzhu cbc4a81140 Add Count tests 2020-05-24 11:35:19 +08:00
Jinzhu 5ec4fee797 Don't preload if foreign keys zero 2020-05-23 21:09:03 +08:00
Jinzhu 72460df1bd Fix associations find 2020-05-23 11:57:28 +08:00
Jinzhu 0f21272c7f Finish implement association support 2020-05-20 23:44:50 +08:00
Jinzhu 20cb57b1ac Add association Delete support 2020-05-20 02:03:43 +08:00
Jinzhu 922a8efc53 Generate Query Conds for Relationship 2020-05-19 21:50:06 +08:00
Jinzhu f999240e10 Define association API, add conds to when preloading 2020-05-14 20:54:50 +08:00
Jinzhu 5ccd76f76c Setup Transaction 2020-02-23 23:28:59 +08:00
Jinzhu b9cce2be6a Add clause, DB API, model definition 2020-01-29 19:22:44 +08:00
Jinzhu f0d514e330 Cleanup 2020-01-28 16:22:07 +08:00
RikiyaFujii 50c61291de add comment (#2163)
* add comment

* typo
2018-11-03 21:55:52 +08:00
Iskander (Alex) Sharipov 742154be9a rewrite if-else chain as switch statement (#2121)
From effective Go: https://golang.org/doc/effective_go.html#switch

> It's therefore possible—and idiomatic—to write an if-else-if-else chain as a switch.
2018-10-07 08:49:37 +08:00
Jinzhu 44b9911f51 Refactor self referencing m2m support 2018-02-10 21:21:50 +08:00
Jinzhu eae7f6be60 Fix source type is incorrect error for embedded many to many relationship 2017-06-14 17:33:21 +08:00