增加规则默认实例

This commit is contained in:
2024-04-29 14:08:50 +08:00
parent f175cc4f75
commit 7454036bf5
4 changed files with 118 additions and 4 deletions

View File

@ -17,6 +17,9 @@ type FieldRule struct {
Type string `json:"type"` // 数据类型, 具体枚举值参见 git.zhangdeman.cn/zhangdeman/consts
DefaultValue string `json:"default_value"` // 默认值, 统一以字符串传入, 会转为最终设置的类型
IsRequired bool `json:"is_required"` // 是否必传
AllowEmpty bool `json:"allow_empty"` // 必传时空字符串是否合法
AllowZero bool `json:"allow_zero"` // 必传数字, 0 是否合法
AllowNil bool `json:"allow_nil"` // 必传时, nil值是否合法
RequiredConditionGroup [][]RequiredCondition `json:"required_condition_group"` // 满足何种条件,字段必传,不配置则为无差别必传, 组之间是或条件, 满足一组即命中, 组之内为与条件
ValueLimit *ValueLimit `json:"value_limit"` // 数据值的限制
}
@ -63,8 +66,8 @@ type StringValueLimit struct {
//
// Date : 11:22 2024/4/29
type IntValueLimit struct {
Min int64 `json:"min"` // 最小值(包含)
Max int64 `json:"max"` // 最大值(不包含)
Min *int64 `json:"min"` // 最小值(包含)
Max *int64 `json:"max"` // 最大值(不包含)
EnumList []int64 `json:"enum_list"` // 枚举值列表
}
@ -74,8 +77,8 @@ type IntValueLimit struct {
//
// Date : 11:22 2024/4/29
type FloatValueLimit struct {
Min float64 `json:"min"` // 最小值(包含)
Max float64 `json:"max"` // 最大值(不包含)
Min *float64 `json:"min"` // 最小值(包含)
Max *float64 `json:"max"` // 最大值(不包含)
EnumList []float64 `json:"enum_list"` // 枚举值列表
}