validate

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRequestURI

func IsRequestURI(uri string) bool

IsRequestURI check if the string is an URL.

Types

type Method

type Method interface {
	MatchString(s string) bool
	String() string
}

type PasswordChecker

type PasswordChecker struct {
}

func (*PasswordChecker) MatchString

func (p *PasswordChecker) MatchString(s string) bool

func (*PasswordChecker) String

func (p *PasswordChecker) String() string

type Rule

type Rule struct {
	Min    int
	Max    int
	Regexp Method
	Hide   bool // if true, do not print the value when return invalid result
}

func (*Rule) Match

func (v *Rule) Match(s interface{}) (ok bool, invalidValue interface{})

func (*Rule) String

func (v *Rule) String() string

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *Validator

func (*Validator) AddRule

func (v *Validator) AddRule(name string, rule *Rule)

func (*Validator) AddRules

func (v *Validator) AddRules(in map[string](*Rule))

func (*Validator) AddSub

func (v *Validator) AddSub(name string, s *Validator)

func (*Validator) AddSubs

func (v *Validator) AddSubs(in map[string](*Validator))

func (*Validator) GetRule

func (v *Validator) GetRule(name string) *Rule

func (*Validator) GetRules

func (v *Validator) GetRules() map[string](*Rule)

func (*Validator) GetSub

func (v *Validator) GetSub(name string) *Validator

func (*Validator) GetSubs

func (v *Validator) GetSubs() map[string](*Validator)

func (*Validator) Init

func (v *Validator) Init(f func(*Validator)) *Validator

func (*Validator) Validate

func (v *Validator) Validate(s interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL