Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RegexValidateRule ¶
type RegexValidateRule struct {
// contains filtered or unexported fields
}
RegexValidateRule contains an validate tag's info
func NewRule ¶
func NewRule(tag, regexStr string, opt *Option) *RegexValidateRule
NewRule news a rule
func (*RegexValidateRule) Explain ¶
func (r *RegexValidateRule) Explain() string
Explain explains the rule
func (*RegexValidateRule) Tag ¶
func (r *RegexValidateRule) Tag() string
Tag returns the validate rule's tag
func (*RegexValidateRule) Validate ¶
func (r *RegexValidateRule) Validate(s string) bool
Validate validates string
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates data not safe, use it after initialized
func (*Validator) AddErrorTranslation4Tag ¶
AddErrorTranslation4Tag adds translation for the errors of some tag, to make the error easier to understand
func (*Validator) RegisterRule ¶
func (v *Validator) RegisterRule(r *RegexValidateRule) error
RegisterRule registers a custom validate rule
Click to show internal directories.
Click to hide internal directories.