Commit Graph

60 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
Mayank Govilla d9d5c4dce0
Fix self-referential belongs to constraint (#4801)
* create tests for self-ref has one migration

* add relation equality check to avoid skipping self-referential schemas

* remove drop table error check
2021-11-08 09:47:29 +08:00
Paras Waykole 5d91ddac8c
fixed belongs_to & has_one reversed if field same (proper fix) (#4694)
* fixed belongs_to & has_one reversed if field same

* hasmany same foreign key bug fixed and test added

* belongsToSameForeignKey fixed and reverted old fix
2021-10-08 10:59:55 +08:00
wangyuehong 80497f27a6
title foreign schema for many2many to avoid panic (#4496)
Co-authored-by: yuehong.wang <yuehong.wang@dena.jp>
2021-07-13 16:36:22 +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
Brenda Wallace ac722c16f9
Small grammar fix in error message (#4406) 2021-05-24 10:23:34 +08:00
Paras Waykole 79f427d862
fixed has_many stopped working if field names are identical (#4387)
* fixed belongs_to & has_one reversed if field same

* hasmany same foreign key bug fixed and test added
2021-05-19 16:05:29 +08:00
Paras Waykole 8f7f3ad315
fixed belongs_to & has_one reversed if field same (#4343) 2021-05-05 07:57:54 +08:00
Jinzhu 70e93e73d8 Check data type if copyable before change reference field's type 2021-04-30 16:35:55 +08:00
Chris Faulkner 15a46bc042
Fix some typos (#4294) 2021-04-19 21:03:39 +08:00
Shubhendra Singh Chauhan 0348b1d3c1
chore: improve code quality (#4123)
* Combine multiple `append`s into a single call

* Clean up copied struct fields with type conversion

* Remove unnecessary use of slice
2021-03-08 10:46:43 +08:00
heige 02cb40531e
Optimize parse constraint (#4153)
* for Config.cacheStore store PreparedStmtDB key

* invalid db error and value and invalid value length error (#4151)

* support named params in Select API  (#4142)

* adds support for named arguments in select

* changes clause identifies and adds test

* optimize match english letters and midline

Co-authored-by: Ratan Phayade <ratanphayade@users.noreply.github.com>
2021-03-08 10:21:33 +08:00
Jinzhu 92a2389450 Fix create duplicated constraint, close #4090 2021-02-16 08:35:19 +08:00
Jinzhu 628a0ae707 Fix foreign key & reference with same name, close #4081 2021-02-15 09:10:51 +08:00
Jinzhu 8f37cb0195 Make has to be a const, close #4024 2021-02-01 10:42:13 +08:00
Jinzhu 916338a9e1 Test migrate constraints, close #3986 2021-01-26 13:39:34 +08:00
Jinzhu 6095dbf939 Fix parse embedded relations, close #3964, #3965 2021-01-19 15:40:04 +08:00
Lisa Casner ce610a9560
title case schema name (#3940) 2021-01-13 13:05:05 +08:00
Jinzhu b864a5457a Allow foreign key following the default naming conventions, close #3928 2021-01-10 17:32:17 +08:00
Jinzhu 065787c54e Compatible with with foreign key with ID suffix #3890 2020-12-28 18:20:55 +08:00
Jinzhu 8bf50a5592 Fix parse relations if only specfied References, close #3890 2020-12-28 17:58:12 +08:00
Jinzhu 6a0fca2195 Return error for invalid relations definition, close #3830 2020-12-06 18:07:16 +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 f6ed895caf Build relationships if fields are not ignored, fix #3181 2020-09-09 16:37:05 +08:00
Jinzhu f2adb088c5 Set field size from primary fields to foreign fields 2020-09-03 16:11:15 +08:00
Jinzhu 162367be7d Fix multiple M2M relations on one table, close #3347 2020-09-01 11:30:16 +08:00
Jinzhu c19a3abefb Fix self-referential belongs to, close #3319 2020-08-28 11:31:13 +08:00
Jinzhu 0f3201e73b friendly invalid field error message 2020-08-25 18:18:16 +08:00
Jinzhu 2b510d6423 Don't create index for join table, close #3294 2020-08-21 15:40:50 +08:00
Jinzhu 6834c25cec Fix stack overflow for embedded self-referred associations, close #3269 2020-08-17 12:02:46 +08:00
Jinzhu ff985b90cc Fix failed to guess relations for embedded types, close #3224 2020-08-04 12:25:34 +08:00
Jinzhu 2676fa4fb8 Remove autoincrement tag for join table, close #3217 2020-07-31 18:19:25 +08:00
Jinzhu ef002fd7ac Add GORMDataType to Field, close #3171 2020-07-20 19:00:03 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +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 619cd332ec Add index priority supports 2020-07-08 17:59:40 +08:00
Jinzhu d4f8a52442 Fix join table foreign key in snake_case 2020-07-04 07:24:46 +08:00
Jinzhu fee1e4aafd Fix create foreign keys for many2many relations 2020-06-21 10:48:23 +08:00
Jinzhu a1e35bdc94 Support merge batch data some having primary values 2020-06-20 16:52:15 +08:00
Jinzhu 4f19e2a7b3 Test ForeignKeyConstraints 2020-06-20 01:20:18 +08:00
Jinzhu 5790ba9ef4 Fix package path 2020-06-02 09:25:55 +08:00
Jinzhu e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu 5ecbf25b22 Drop table with CASCADE option 2020-06-02 07:56:53 +08:00
Jinzhu e490e09db5 Add SetupJoinTable support 2020-06-01 23:58:22 +08:00
Jinzhu 49310d0974 Test override foreign key, reference 2020-05-31 17:42:21 +08:00
Jinzhu cc064f26ee Add on conflict support 2020-05-25 23:11:42 +08:00
Jinzhu 91a695893c Test Association For BelongsTo 2020-05-24 18:33:15 +08:00
Jinzhu 922a8efc53 Generate Query Conds for Relationship 2020-05-19 21:50:06 +08:00
Jinzhu 04adbaf7f6 Fix parse stmt ReflectValue 2020-02-24 08:51:35 +08:00
Jinzhu fa22807e12 Make inesrt into db works 2020-02-23 19:41:29 +08:00