修复数组最大长度验证的BUG
This commit is contained in:
parent
5396616b24
commit
2d8d05044c
@ -286,7 +286,7 @@ func validateSlice(anySlice []any, rule *define.FieldRule) error {
|
|||||||
return fmt.Errorf("%v : data type is slice, min length is [%v], real length is [%v]", rule.Path, *rule.ValueLimit.Min, len(anySlice))
|
return fmt.Errorf("%v : data type is slice, min length is [%v], real length is [%v]", rule.Path, *rule.ValueLimit.Min, len(anySlice))
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != rule.ValueLimit.Max && float64(len(anySlice)) > *rule.ValueLimit.Min {
|
if nil != rule.ValueLimit.Max && float64(len(anySlice)) > *rule.ValueLimit.Max {
|
||||||
return fmt.Errorf("%v : data type is slice, max length is [%v], real length is [%v]", rule.Path, *rule.ValueLimit.Max, len(anySlice))
|
return fmt.Errorf("%v : data type is slice, max length is [%v], real length is [%v]", rule.Path, *rule.ValueLimit.Max, len(anySlice))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user