summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-playground/validator/v10/cache.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-05-02 14:05:18 +0100
committerLibravatar GitHub <noreply@github.com>2022-05-02 15:05:18 +0200
commitb56dae8120d43b9acd3d3ed4d40100ffab7b972a (patch)
treed55d30589d8a8499ed3d5eecba163abc9fa78c27 /vendor/github.com/go-playground/validator/v10/cache.go
parentadd extra indexes as a migration (#527) (diff)
downloadgotosocial-b56dae8120d43b9acd3d3ed4d40100ffab7b972a.tar.xz
[chore] Update all but bun libraries (#526)
* update all but bun libraries Signed-off-by: kim <grufwub@gmail.com> * remove my personal build script changes Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/go-playground/validator/v10/cache.go')
-rw-r--r--vendor/github.com/go-playground/validator/v10/cache.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/github.com/go-playground/validator/v10/cache.go b/vendor/github.com/go-playground/validator/v10/cache.go
index 0d18d6ec4..7b84c91fe 100644
--- a/vendor/github.com/go-playground/validator/v10/cache.go
+++ b/vendor/github.com/go-playground/validator/v10/cache.go
@@ -114,12 +114,13 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
cs = &cStruct{name: sName, fields: make([]*cField, 0), fn: v.structLevelFuncs[typ]}
numFields := current.NumField()
+ rules := v.rules[typ]
var ctag *cTag
var fld reflect.StructField
var tag string
var customName string
-
+
for i := 0; i < numFields; i++ {
fld = typ.Field(i)
@@ -128,7 +129,11 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
continue
}
- tag = fld.Tag.Get(v.tagName)
+ if rtag, ok := rules[fld.Name]; ok {
+ tag = rtag
+ } else {
+ tag = fld.Tag.Get(v.tagName)
+ }
if tag == skipValidationTag {
continue