feat: 修复数字取值范围与字符长度限制显示错误问题
This commit is contained in:
@@ -23,6 +23,7 @@ func ParseValidateRule(dataType reflect.Type, ruleStr string) ValidateRule {
|
||||
}
|
||||
dataKind := dataType.Kind()
|
||||
rule := ValidateRule{
|
||||
IsString: dataKind == reflect.String,
|
||||
Omitempty: false,
|
||||
Required: false,
|
||||
Lte: nil,
|
||||
@@ -75,8 +76,10 @@ func ParseValidateRule(dataType reflect.Type, ruleStr string) ValidateRule {
|
||||
rule.Lt = &val
|
||||
case consts.ValidatorRuleCommonLen.String():
|
||||
rule.Len = &val
|
||||
|
||||
case consts.ValidatorRuleCommonMin.String():
|
||||
rule.Min = &val
|
||||
|
||||
case consts.ValidatorRuleCommonMax.String():
|
||||
rule.Max = &val
|
||||
}
|
||||
@@ -110,6 +113,7 @@ func ParseValidateRule(dataType reflect.Type, ruleStr string) ValidateRule {
|
||||
}
|
||||
|
||||
type ValidateRule struct {
|
||||
IsString bool `json:"is_string" dc:"是否字符串"`
|
||||
Omitempty bool `json:"omitempty" dc:"为空则不校验"`
|
||||
Required bool `json:"required" dc:"必传校验"`
|
||||
Lte *float64 `json:"lte" dc:"数字类型小于等于"`
|
||||
|
||||
Reference in New Issue
Block a user