feat: validate v10 校验规则结构化处理
This commit is contained in:
34
util/validate_v10_parse.go
Normal file
34
util/validate_v10_parse.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// Package util ...
|
||||||
|
//
|
||||||
|
// Description : util ...
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 2026-01-05 18:48
|
||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ParseValidateRule 解析验证规则
|
||||||
|
func ParseValidateRule(dataType reflect.Kind, ruleStr string) map[string]any {
|
||||||
|
ruleList := strings.Split(ruleStr, ",")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ValidateRule struct {
|
||||||
|
Omitempty bool `json:"omitempty" dc:"为空则不校验"`
|
||||||
|
Required bool `json:"required" dc:"必传校验"`
|
||||||
|
Lte *float64 `json:"lte" dc:"数字类型小于等于"`
|
||||||
|
Gte *float64 `json:"gte" dc:"数字类型大于等于"`
|
||||||
|
Lt *float64 `json:"lt" dc:"数字类型小于"`
|
||||||
|
Gt *float64 `json:"gt" dc:"数字类型大于"`
|
||||||
|
Len *uint `json:"len" dc:"长度等于"`
|
||||||
|
Max *uint `json:"max" dc:"长度小于等于"`
|
||||||
|
Min *uint `json:"min" dc:"长度大于等于"`
|
||||||
|
Eq any `json:"eq" dc:"等于"`
|
||||||
|
Ne any `json:"ne" dc:"不等于"`
|
||||||
|
Oneof []any `json:"oneof" dc:"枚举值列表"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user