Documentation
¶
Index ¶
- Constants
- Variables
- func Email(v string, lookup bool) error
- func EmailRFC5322(v string, lookup bool) error
- func EmailWeak(v string) error
- func Enum(v Enumerator) error
- func MaxFloat32(v, expected float32) error
- func MaxFloat32s(v []float32, expected int) error
- func MaxFloat64(v, expected float64) error
- func MaxFloat64s(v []float64, expected int) error
- func MaxInt(v, expected int) error
- func MaxInt8(v, expected int8) error
- func MaxInt8s(v []int8, expected int) error
- func MaxInt32(v, expected int32) error
- func MaxInt32s(v []int32, expected int) error
- func MaxInt64(v, expected int64) error
- func MaxInt64s(v []int64, expected int) error
- func MaxInts(v []int, expected int) error
- func MaxString(v string, expected int) error
- func MaxStrings(v []string, expected int) error
- func MaxUInt(v, expected uint) error
- func MaxUInt8(v, expected uint8) error
- func MaxUInt8s(v []uint8, expected int) error
- func MaxUInt32(v, expected uint32) error
- func MaxUInt32s(v []uint32, expected int) error
- func MaxUInt64(v, expected uint64) error
- func MaxUInt64s(v []uint64, expected int) error
- func MaxUInts(v []uint, expected int) error
- func MinFloat32(v, expected float32) error
- func MinFloat64(v, expected float64) error
- func MinInt(v, expected int) error
- func MinInt8(v, expected int8) error
- func MinInt32(v, expected int32) error
- func MinInt64(v, expected int64) error
- func MinString(v string, expected int) error
- func Regex(v string, regexp *regexp.Regexp) error
- func RequiredFloat32(v float32) error
- func RequiredFloat64(v float64) error
- func RequiredInt(v int) error
- func RequiredInt8(v int8) error
- func RequiredInt32(v int32) error
- func RequiredInt64(v int64) error
- func RequiredString(v string) error
- func RequiredStrings(v []string) error
- func SizeFloat32(v, expected float32) error
- func SizeFloat64(v, expected float64) error
- func SizeInt(v, expected int) error
- func SizeInt8(v, expected int8) error
- func SizeInt32(v, expected int32) error
- func SizeInt64(v, expected int64) error
- func SizeString(v string, expected int) error
- func SizeStrings(v []string, expected int) error
- type Enumerator
- type Fields
- type FieldsError
- type FieldsErrors
- type RequiredError
- type Rule
- type RuleError
- func NewFendEmailError() *RuleError
- func NewFendEnumError() *RuleError
- func NewFendError(fend Rule, meta string) *RuleError
- func NewFendMaxError(verb rune, v interface{}) *RuleError
- func NewFendMinError(verb rune, v interface{}) *RuleError
- func NewFendRegexError() *RuleError
- func NewFendRequiredError() *RuleError
- func NewFendSizeError(verb rune, v interface{}) *RuleError
Constants ¶
View Source
const ( DefaultRuleDelimiter = ";" DefaultNameDelimiter = ":" DefaultErrorDelimiter = "," DefaultMetaDelimiter = "|" )
View Source
const ( RuleEmail Rule = "email" // EmailRegexWeak as https://davidcel.is/posts/stop-validating-email-addresses-with-regex/ EmailRegexWeak = ".+@.+\\..+" // EmailRegexRFC5322 as https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression/201378#201378 EmailRegexRFC5322 = "" /* 497-byte string literal not displayed */ )
Variables ¶
View Source
var ( RuleDelimiter = DefaultRuleDelimiter NameDelimiter = DefaultNameDelimiter ErrorDelimiter = DefaultErrorDelimiter MetaDelimiter = DefaultMetaDelimiter )
Functions ¶
func EmailRFC5322 ¶
EmailRFC5322 validation using RFC5322 regex
func Enum ¶
func Enum(v Enumerator) error
func MaxFloat32 ¶
func MaxFloat32s ¶
func MaxFloat64 ¶
func MaxFloat64s ¶
func MaxStrings ¶
func MaxUInt32s ¶
func MaxUInt64s ¶
func MinFloat32 ¶
func MinFloat64 ¶
func RequiredFloat32 ¶
func RequiredFloat64 ¶
func RequiredInt ¶
func RequiredInt8 ¶
func RequiredInt32 ¶
func RequiredInt64 ¶
func RequiredString ¶
func RequiredStrings ¶
func SizeFloat32 ¶
func SizeFloat64 ¶
func SizeString ¶
func SizeStrings ¶
Types ¶
type Enumerator ¶
type Enumerator interface {
Valid() bool
}
type Fields ¶
type Fields struct {
// contains filtered or unexported fields
}
Fields type
func (Fields) FirstError ¶
FirstError returns only all fields first errors as error type
type FieldsError ¶
FieldsError type
func NewFieldsError ¶
func NewFieldsError(e map[string]error) *FieldsError
NewFieldsError constructor
type FieldsErrors ¶
FieldsErrors type
func NewFieldsErrors ¶
func NewFieldsErrors(e map[string][]error) *FieldsErrors
NewFieldsErrors constructor
type RequiredError ¶
type RequiredError struct {
Type Rule `json:"type"`
}
type Rule ¶
type Rule string
const RuleEnum Rule = "enum"
const RuleMax Rule = "max"
const RuleMin Rule = "min"
const RuleRegex Rule = "regex"
const RuleRequired Rule = "required"
const RuleSize Rule = "size"
type RuleError ¶
func NewFendMaxError ¶
NewFendMaxError constructor
func NewFendMinError ¶
NewFendMinError constructor
func NewFendSizeError ¶
NewFendSizeError constructor
Click to show internal directories.
Click to hide internal directories.