Documentation ¶
Index ¶
Constants ¶
View Source
const ( VALIDATOR_ASSIGNMENT_SIGN = "=" VALIDATOR_PARAMS_SPLIT_SIGN = "|" VALIDATOR_PLACEHOLDER_SIGN = "_" VALIDATOR_SPLIT_SIGN = "||" )
View Source
const (
EQUAL_ERR = "[name] should be equal [value]"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IValidator ¶
type InValidator ¶
type InValidator struct {
Equal
}
InValidator 仅支持 string,float,int,bool 类型 或值类型为 string,float,int,bool 类型的array,slice,map
type Kind ¶
type Kind uint
const ( TYPE_INVALID = "[name] type invalid" PARAMS_INVALID = "[name] params invalid" STRUCT_EMPTY = "struct %v is empty" VALIDATOR_ALREADY_EXISTED = "[%s] validator already existed" Int_Kind Kind = iota Int8_Kind Int16_Kind Int32_Kind Int64_Kind Uint_Kind Uint8_Kind Uint16_Kind Uint32_Kind Uint64_Kind Float32_Kind Float64_Kind Array_Kind Slice_Kind Map_Kind Chan_Kind String_Kind )
type MultiValidator ¶
MultiValidator
type NumberValidator ¶
NumberValidator
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
func (*Range) CompareNumberRange ¶
type StringValidator ¶
StringValidator
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) AddValidator ¶
func (v *Validator) AddValidator(key string, validator IValidator) error
添加验证器
func (*Validator) LazyValidate ¶
Click to show internal directories.
Click to hide internal directories.