Documentation
¶
Index ¶
Constants ¶
View Source
const InCheckerName = "in"
InCheckerName 包含验证器
View Source
const InValueDelimiter = ","
InValueDelimiter in值分割字符
View Source
const LenCheckerName = "len"
LenCheckerName 长度验证器token
View Source
const NotEmptyCheckerName = "notEmpty"
NotEmptyCheckerName 验证不为空的方法token
View Source
const ValueCheckerName = "value"
ValueCheckerName 值验证方法名token
Variables ¶
This section is empty.
Functions ¶
func SetCheckMethods ¶
func SetCheckMethods(method string, factory func(*Checker) (IValidator, error))
SetCheckMethods 注册验证器到方法池
Types ¶
type AbstractValidator ¶
AbstractValidator 验证器抽象类
func (*AbstractValidator) GetReturn ¶
func (vr *AbstractValidator) GetReturn(msg string) string
GetReturn 返回return字符串
func (*AbstractValidator) SetIndent ¶
func (vr *AbstractValidator) SetIndent(s string)
SetIndent 设置缩进
func (*AbstractValidator) SetReturn ¶
func (vr *AbstractValidator) SetReturn(s string)
SetReturn 设置换行符
type IValidator ¶
IValidator 验证器接口
func NewInValidator ¶
func NewInValidator(checker *Checker) (IValidator, error)
NewInValidator 返回存在验证器
func NewLenValidator ¶
func NewLenValidator(checker *Checker) (IValidator, error)
NewLenValidator 返回长度验证器
func NewNotEmptyValidator ¶
func NewNotEmptyValidator(checker *Checker) (IValidator, error)
NewNotEmptyValidator 构造新的非空验证器
func NewValueValidator ¶
func NewValueValidator(checker *Checker) (IValidator, error)
NewValueValidator 返回值验证器
type Lexer ¶
type Lexer struct { PointerAlias string // contains filtered or unexported fields }
Lexer 字段tag分析器
func (*Lexer) GetUsedImports ¶
GetUsedImports 返回生成文件中使用过的package
func (*Lexer) GetValidatorList ¶
func (l *Lexer) GetValidatorList() ([]IValidator, error)
GetValidatorList 获取字段的验证器列表
Click to show internal directories.
Click to hide internal directories.