Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataValidater ¶
type DataValidater struct {
Validater interface{}
}
数据验证器对象,里面封装了具体的验证器
func (DataValidater) Validate ¶
func (validater DataValidater) Validate(dataMap map[string]interface{}, ai sql_interface.SqlActionInterface, primaryKey string, operationType int) (string, bool)
验证器的验证方法
type ExistValidater ¶
type ExistValidater struct {
TargetModel string //目标模型
ConditionField string //条件字段
ConditionValue string //条件值
FieldArray []ValidateField //验证的字段数组
Message string //错误消息
OperateType int //支持的数据库操作类型
IsNot bool //是否为不存在验证
}
存在验证器
type LengthValidater ¶
type LengthValidater struct {
FieldName string //字段名
MinLength int //最小长度
MaxLength int //最大长度
Message string //错误消息
OperateType int //支持的数据库操作类型
}
长度验证器
type NilValidater ¶
type NilValidater struct {
FieldName string //字段名
Message string //错误消息
OperateType int //支持的数据库操作类型
}
空验证器
type RegexValidater ¶
type RegexValidater struct {
FieldName string //字段名
Regex string //正则表达式
Message string //错误消息
OperateType int //支持的数据库操作类型
}
正则表达式验证器
type ValidateField ¶
验证字段
type ValidaterInterface ¶
type ValidaterInterface interface {
//验证方法
Validate(dataMap map[string]interface{}, ai sql_interface.SqlActionInterface, primaryKey string, operationType int) (string, bool)
}
验证器接口
Click to show internal directories.
Click to hide internal directories.