Commit Graph

2564 Commits

Author SHA1 Message Date
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
heige 221d0a0ec1
optimize value of reflection length (#4152) 2021-03-08 10:20:04 +08:00
Ratan Phayade a3abb5fedf
support named params in Select API (#4142)
* adds support for named arguments in select

* changes clause identifies and adds test
2021-03-07 10:59:00 +08:00
heige bc347758e5
for Config.cacheStore store PreparedStmtDB key (#4149) 2021-03-07 10:57:22 +08:00
heige 495ec4bd87
invalid db error and value and invalid value length error (#4151) 2021-03-07 10:56:32 +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
Jinzhu 294625759c Fix after initialize db callback 2021-03-05 14:12:55 +08:00
Jinzhu 1476b2f7d4 Fix apply config 2021-03-04 20:37:44 +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
Jinzhu 664755270d Don't override the from clauses, close #4129 2021-03-04 19:16:08 +08:00
Jinzhu 90476fea7a Fix Join with slice IN, close #4133 2021-03-04 18:40:47 +08:00
Jinzhu 42999e9809 Fix overwrite preloading associations, close #4134 2021-03-04 18:28:32 +08:00
Jinzhu 0157099576 Use functional options 2021-03-04 17:40:25 +08:00
Jinzhu 3694ef4a2c Fix get current table 2021-02-26 17:30:00 +08:00
Jinzhu eb9a704fda Fix update UpdatedAt when full saving associations, close #4115 2021-02-26 17:11:25 +08:00
Jinzhu 189547f615 Fix new session with Begin, close #4120 2021-02-26 16:43:43 +08:00
Jinzhu ddeb143eb9 Lazy call registered scopes 2021-02-25 22:01:59 +08:00
Jinzhu 6b7d18656d Lazy call registered scopes 2021-02-25 20:06:26 +08:00
Jinzhu 828e6b646b Lazy call registered scopes 2021-02-25 18:49:01 +08:00
Jinzhu 940da051a7 Skip nested associations when create data with Select, close #4108 2021-02-23 19:35:24 +08:00
Jinzhu 79225bfe48 Fix Omit/Select without Model value, close #4098 2021-02-18 10:53:29 +08:00
Jinzhu 73d44a4f97 Fix create duplicated constraint, close #4090 2021-02-16 08:52:56 +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
Joel Nordell 5744e29fbd
Replacer interface for more flexible NamingStrategy (#4042)
* Change NameReplacer to an interface, allowing custom Replacers.

* Add NoLowerCase option to skip the snake_casing of names.

* Move sync.Map from global variable into member of NamingStrategy.

This maintains backward compatibility by making the smap optional - the
NamingStrategy still works if it is nil. gorm.Open activates it by
calling Init() if the given Namer is a schema.NamingStrategy.

Also, this changes the key stored in the smap to be the original name,
instead of the replaced name.

* Refactor NamingStrategy tests to add more assertions about how and when Replacers get called.

* Remove the name cache from NamingStrategy.
2021-02-14 08:16:24 +08:00
Jinzhu a13b7a6acb Fix OnConflict where order for postgres, close #4073 2021-02-10 14:11:29 +08:00
Jinzhu 84ea3ec0cc Fix sub query argument order with multiple raw SQL 2021-02-09 19:56:45 +08:00
Jinzhu df24821896 Fix SubQuery for raw sql 2021-02-09 17:05:50 +08:00
yrong1997 2ba612e805
Add field tag to ignore migration (#4028)
* Add field tag to ignore migration

* Fix null value with space

* refactor migration tag
2021-02-09 16:03:02 +08:00
Jinzhu 883c32e59a Support Unscoped when delete with selected associations, close #4062 2021-02-07 14:36:27 +08:00
Jinzhu deff0594ee Save associations based on creatable/updatable permission, close #4056 2021-02-07 14:24:11 +08:00
Jinzhu 4373aa01ab Don't call AfterFind hooks if no record found, close #4048 2021-02-07 12:44:59 +08:00
Jinzhu bb153384d1 Switch driver.Valuer, fmt.Stringer order when format SQL 2021-02-07 11:18:42 +08:00
heige e80853e7f5
optimization check for ParseCheckConstraints (#4063) 2021-02-07 10:12:13 +08:00
heige ef5ef18d4a
recommended to use magic const strings (#4059) 2021-02-07 10:09:32 +08:00
Jinzhu 3d3208ed60 initialize config plugins 2021-02-03 16:27:49 +08:00
Jinzhu 8f37cb0195 Make has to be a const, close #4024 2021-02-01 10:42:13 +08:00
Jinzhu db0cc4d60b Fix too long foreign key/checker names, close #4026 2021-02-01 10:37:12 +08:00
Jinzhu 7598204dc3 Support `FullSaveAssociations` for association mode, close #4010 2021-01-29 16:55:26 +08:00
Jinzhu 6e3ac74b7e Fix preloading all associations together with nested associations, close #4016 2021-01-28 20:18:01 +08:00
David Harkness 4267df02af
Fix typo in README (#4012) 2021-01-28 10:21:58 +08:00
Jinzhu 8500380e60 Add name checker test, close #4007 2021-01-27 17:45:59 +08:00
Ben cc61202fe2
retrieving gorm object support pointer (#4006) 2021-01-27 11:50:15 +08:00
Jinzhu 81aa949105 Remove the uncessary reflect.Ptr 2021-01-27 11:48:47 +08:00
rorschach ba59065024 retrieving gorm object support pointer 2021-01-27 11:48:47 +08:00
Manyanda Chitimbo f6308ed223
refactor: fix typo in tests.yml (#4005) 2021-01-27 11:18:39 +08:00
Jinzhu 7f198ead0e Refactor nested preloading associations, close #3970 2021-01-26 16:33:19 +08:00
Jinzhu 08678106a4 Support replace associations without the creation in association mode, close #3937 2021-01-26 14:34:21 +08:00