Documentation
¶
Index ¶
- Variables
- type BoolRule
- type Error
- func NewBoolRuleError(v bool) *Error
- func NewCustomRuleError(rule string, meta ...string) *Error
- func NewEmailError() *Error
- func NewError(cause error, rule string, meta ...string) *Error
- func NewMaxError(verb rune, v interface{}) *Error
- func NewMinError(verb rune, v interface{}) *Error
- func NewRegexError() *Error
- func NewRequiredError() *Error
- func NewSizeError(verb rune, v interface{}) *Error
- func NewValidError() *Error
- func NewVarError(tag, meta string) *Error
- type Float32Rule
- type Float64Rule
- type Int8Rule
- type Int32Rule
- type Int64Rule
- type IntRule
- type InterfaceRule
- type Name
- type Rule
- func Email(v string) Rule
- func EmailLookup(v string) Rule
- func EmailWeak(v string) Rule
- func False(v bool) Rule
- func RequiredFloat32(v float32) Rule
- func RequiredFloat64(v float64) Rule
- func RequiredInt(v int) Rule
- func RequiredInt8(v int8) Rule
- func RequiredInt32(v int32) Rule
- func RequiredInt64(v int64) Rule
- func RequiredString(v string) Rule
- func RequiredUInt(v uint) Rule
- func RequiredUInt8(v uint8) Rule
- func RequiredUInt32(v uint32) Rule
- func RequiredUInt64(v uint64) Rule
- func True(v bool) Rule
- type StringRule
- type UInt8Rule
- type UInt32Rule
- type UInt64Rule
- type UIntRule
- type Validator
- type ValidatorRule
Constants ¶
This section is empty.
Variables ¶
View Source
var Err = errors.New("rule violation")
View Source
var ErrBool = errors.New(NameBool.String())
View Source
var ErrCustom = errors.New(NameCustom.String())
View Source
var ErrEmail = errors.New(NameEmail.String())
View Source
var ErrMax = errors.New(NameMax.String())
View Source
var ErrMin = errors.New(NameMin.String())
View Source
var ErrRegex = errors.New(NameRegex.String())
View Source
var ErrRequired = errors.New(NameRequired.String())
View Source
var ErrSize = errors.New(NameSize.String())
View Source
var ErrValid = errors.New(NameValid.String())
View Source
var ErrVar = errors.New(NameVar.String())
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewCustomRuleError ¶ added in v0.3.4
NewCustomRuleError constructor
type Float32Rule ¶
func MaxFloat32 ¶
func MaxFloat32(expected float32) Float32Rule
func MinFloat32 ¶
func MinFloat32(expected float32) Float32Rule
func SizeFloat32 ¶
func SizeFloat32(expected float32) Float32Rule
type Float64Rule ¶
func MaxFloat64 ¶
func MaxFloat64(expected float64) Float64Rule
func MinFloat64 ¶
func MinFloat64(expected float64) Float64Rule
func SizeFloat64 ¶
func SizeFloat64(expected float64) Float64Rule
type InterfaceRule ¶
type InterfaceRule func(v interface{}) Rule
func Var ¶
func Var(tag string) InterfaceRule
type Name ¶
type Name string
const NameBool Name = "bool"
const NameCustom Name = "custom"
const (
NameEmail Name = "email"
)
const NameMax Name = "max"
const NameMin Name = "min"
const NameRegex Name = "regex"
const NameRequired Name = "required"
const NameSize Name = "size"
const NameValid Name = "valid"
const NameVar Name = "var"
type Rule ¶
type Rule func() *Error
func EmailLookup ¶ added in v0.3.2
EmailLookup validation using simple regex
func RequiredFloat32 ¶
func RequiredFloat64 ¶
func RequiredInt ¶
func RequiredInt8 ¶
func RequiredInt32 ¶
func RequiredInt64 ¶
func RequiredString ¶
func RequiredUInt ¶
func RequiredUInt8 ¶
func RequiredUInt32 ¶
func RequiredUInt64 ¶
type StringRule ¶
func MaxString ¶
func MaxString(expected int) StringRule
func MinString ¶
func MinString(expected int) StringRule
func Regex ¶
func Regex(regexp *regexp.Regexp) StringRule
Regex validation using go standard package
func SizeString ¶
func SizeString(expected int) StringRule
type UInt32Rule ¶
func MaxUInt32 ¶
func MaxUInt32(expected uint32) UInt32Rule
func MinUInt32 ¶
func MinUInt32(expected uint32) UInt32Rule
func SizeUInt32 ¶
func SizeUInt32(expected uint32) UInt32Rule
type UInt64Rule ¶
func MaxUInt64 ¶
func MaxUInt64(expected uint64) UInt64Rule
func MinUInt64 ¶
func MinUInt64(expected uint64) UInt64Rule
func SizeUInt64 ¶
func SizeUInt64(expected uint64) UInt64Rule
type ValidatorRule ¶
func Valid ¶
func Valid() ValidatorRule
Click to show internal directories.
Click to hide internal directories.