// Package define ... // // Description : define ... // // Author : go_developer@163.com<白茶清欢> // // Date : 2024-04-29 10:51 package define // FieldRule 字段验证规则 // // Author : go_developer@163.com<白茶清欢> // // Date : 10:52 2024/4/29 type FieldRule struct { Path string `json:"path"` // 字段路径 Type string `json:"type"` // 数据类型, 具体枚举值参见 git.zhangdeman.cn/zhangdeman/consts DefaultValue string `json:"default_value"` // 默认值, 统一以字符串传入, 会转为最终设置的类型 IsRequired bool `json:"is_required"` // 是否必传 RequiredConditionGroup [][]RequiredCondition `json:"required_condition_group"` // 满足何种条件,字段必传,不配置则为无差别必传, 组之间是或条件, 满足一组即命中, 组之内为与条件 ValueLimit *ValueLimit `json:"value_limit"` // 数据值的限制 } // RequiredCondition 定义必传条件 // // Author : zhangdeman001@ke.com<张德满> // // Date : 10:58 2024/4/29 type RequiredCondition struct { DependOnField string `json:"depend_on_field"` // 依赖数据园中的那一个字段 DependOnFieldStatus string `json:"depend_on_field_status"` // 依赖数据状态 : NOT_FOUND / IS_NIL / IS_ZERO / IS_EMPTY / IS_FALSE } // ValueLimit 取值的限制 // // Author : go_developer@163.com<白茶清欢> // // Date : 11:15 2024/4/29 type ValueLimit struct { String *StringValueLimit `json:"string"` // 字符串值的限制 Int *IntValueLimit `json:"int"` // int数据验证 Float *FloatValueLimit `json:"float"` // 浮点数据 Slice *SliceValueLimit `json:"slice"` // 数组 Map *MapValueLimit `json:"map"` // map验证 } // StringValueLimit 字符串类型值的限制 // // Author : go_developer@163.com<白茶清欢> // // Date : 11:16 2024/4/29 type StringValueLimit struct { MinLength int64 `json:"min_length"` // 最小长度(包含) MaxLength int64 `json:"max_length"` // 最大长度(不包含) AutoTrimSpace bool `json:"auto_trim_space"` // 自动去除前后空格 IncludeSubStrList []string `json:"include_sub_str_list"` // 必须包含指定的子串 EnumList []string `json:"enum_list"` // 枚举值列表 } // IntValueLimit ... // // Author : go_developer@163.com<白茶清欢> // // Date : 11:22 2024/4/29 type IntValueLimit struct { Min int64 `json:"min"` // 最小值(包含) Max int64 `json:"max"` // 最大值(不包含) EnumList []int64 `json:"enum_list"` // 枚举值列表 } // FloatValueLimit ... // // Author : go_developer@163.com<白茶清欢> // // Date : 11:22 2024/4/29 type FloatValueLimit struct { Min float64 `json:"min"` // 最小值(包含) Max float64 `json:"max"` // 最大值(不包含) EnumList []float64 `json:"enum_list"` // 枚举值列表 } // SliceValueLimit 数组限制 // // Author : go_developer@163.com<白茶清欢> // // Date : 11:23 2024/4/29 type SliceValueLimit struct { MinLength int64 `json:"min_length"` // 最小长度(包含) MaxLength int64 `json:"max_length"` // 最大长度(不包含) } // MapValueLimit map数据的限制 // // Author : go_developer@163.com<白茶清欢> // // Date : 11:23 2024/4/29 type MapValueLimit struct { MinLength int64 `json:"min_length"` // 最小长度(包含) MaxLength int64 `json:"max_length"` // 最大长度(不包含) IncludeFieldList []string `json:"include_field_list"` // 必须存在的字段列表 }