empty map validate fix

local
hzy 1 year ago
parent 430edf2247
commit 9365ff2585
  1. 3
      validator_instance.go

@ -156,6 +156,9 @@ const omitemptyPrefix = "__omitempty__"
// validation validation information via context.Context.
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
errs := make(map[string]interface{})
if len(data) == 0 {
return errs
}
Loop:
for field, rule := range rules {
if strings.HasPrefix(field, omitemptyPrefix) == true {

Loading…
Cancel
Save