feat: 修复数字取值范围与字符长度限制显示错误问题

This commit is contained in:
2026-01-06 19:17:22 +08:00
parent 708e327ddf
commit 088b813045
3 changed files with 20 additions and 7 deletions

View File

@@ -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:"数字类型小于等于"`