优化数据类型验证
This commit is contained in:
@ -7,7 +7,9 @@
|
||||
// Date : 2024-04-29 10:51
|
||||
package define
|
||||
|
||||
import "git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
)
|
||||
|
||||
// FieldRule 字段验证规则
|
||||
//
|
||||
@ -16,7 +18,7 @@ import "git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
// Date : 10:52 2024/4/29
|
||||
type FieldRule struct {
|
||||
Path string `json:"path"` // 字段路径
|
||||
Type enums.DataType `json:"type"` // 数据类型, 具体枚举值参见 git.zhangdeman.cn/zhangdeman/consts
|
||||
Type consts.DataType `json:"type"` // 数据类型, 具体枚举值参见 git.zhangdeman.cn/zhangdeman/consts
|
||||
DisableRewrite bool `json:"disable_rewrite"` // 验证完相关数据类型之后, 不要重新给字段赋值
|
||||
DefaultValue any `json:"default_value"` // 默认值, 统一以字符串传入, 会转为最终设置的类型
|
||||
IsRequired bool `json:"is_required"` // 是否必传
|
||||
@ -37,9 +39,9 @@ type FieldRule struct {
|
||||
//
|
||||
// Date : 10:58 2024/4/29
|
||||
type RequiredCondition struct {
|
||||
DependOnField string `json:"depend_on_field"` // 依赖数据源中的那一个字段
|
||||
DependOnFieldType enums.DataType `json:"depend_on_field_type"` // 依赖数据源数据类型
|
||||
DependOnFieldStatus []string `json:"depend_on_field_status"` // 依赖数据状态 : NOT_FOUND / IS_NIL / IS_ZERO / IS_EMPTY / IS_FALSE
|
||||
DependOnField string `json:"depend_on_field"` // 依赖数据源中的那一个字段
|
||||
DependOnFieldType consts.DataType `json:"depend_on_field_type"` // 依赖数据源数据类型
|
||||
DependOnFieldStatus []string `json:"depend_on_field_status"` // 依赖数据状态 : NOT_FOUND / IS_NIL / IS_ZERO / IS_EMPTY / IS_FALSE
|
||||
}
|
||||
|
||||
// ValueLimit 取值的限制
|
||||
|
Reference in New Issue
Block a user