type Email struct { Match }
func VaildEmail() Email
func (e Email) DefaultMessage() string
type Length struct { N int }
Requires an array or string to be exactly a given length.
func ValidLength(n int) Length
func (s Length) DefaultMessage() string
func (s Length) IsSatisfied(obj interface{}) bool
type Match struct { Regexp *regexp.Regexp }
Requires a string to match a given regex.
func ValidMatch(regex *regexp.Regexp) Match
func (m Match) DefaultMessage() string
func (m Match) IsSatisfied(obj interface{}) bool
type Max struct { Max int }
func ValidMax(max int) Max
func (m Max) DefaultMessage() string
func (m Max) IsSatisfied(obj interface{}) bool
type MaxSize struct { Max int }
Requires an array or string to be at most a given length.
func ValidMaxSize(max int) MaxSize
func (m MaxSize) DefaultMessage() string
func (m MaxSize) IsSatisfied(obj interface{}) bool
type Min struct { Min int }
func ValidMin(min int) Min
func (m Min) DefaultMessage() string
func (m Min) IsSatisfied(obj interface{}) bool
type MinSize struct { Min int }
Requires an array or string to be at least a given length.
func ValidMinSize(min int) MinSize
func (m MinSize) DefaultMessage() string
func (m MinSize) IsSatisfied(obj interface{}) bool
type Range struct { Min Max }
Requires an integer to be within Min, Max inclusive.
func ValidRange(min, max int) Range
func (r Range) DefaultMessage() string
func (r Range) IsSatisfied(obj interface{}) bool
type Required struct{}
func ValidRequired() Required
func (r Required) DefaultMessage() string
func (r Required) IsSatisfied(obj interface{}) bool
type Validator interface { IsSatisfied(interface{}) bool DefaultMessage() string }