Documentation
¶
Index ¶
- Constants
- Variables
- type Enumerator
- type Fend
- func Email(v string, lookup bool) Fend
- func EmailRFC5322(v string, lookup bool) Fend
- func EmailWeak(v string) Fend
- func Enum(v Enumerator) Fend
- func MaxFloat32(v, expected float32) Fend
- func MaxFloat32s(v []float32, expected int) Fend
- func MaxFloat64(v, expected float64) Fend
- func MaxFloat64s(v []float64, expected int) Fend
- func MaxInt(v, expected int) Fend
- func MaxInt8(v, expected int8) Fend
- func MaxInt8s(v []int8, expected int) Fend
- func MaxInt32(v, expected int32) Fend
- func MaxInt32s(v []int32, expected int) Fend
- func MaxInt64(v, expected int64) Fend
- func MaxInt64s(v []int64, expected int) Fend
- func MaxInts(v []int, expected int) Fend
- func MaxString(v string, expected int) Fend
- func MaxStrings(v []string, expected int) Fend
- func MaxUInt(v, expected uint) Fend
- func MaxUInt8(v, expected uint8) Fend
- func MaxUInt8s(v []uint8, expected int) Fend
- func MaxUInt32(v, expected uint32) Fend
- func MaxUInt32s(v []uint32, expected int) Fend
- func MaxUInt64(v, expected uint64) Fend
- func MaxUInt64s(v []uint64, expected int) Fend
- func MaxUInts(v []uint, expected int) Fend
- func MinFloat32(v, expected float32) Fend
- func MinFloat32s(v []float32, expected int) Fend
- func MinFloat64(v, expected float64) Fend
- func MinFloat64s(v []float64, expected int) Fend
- func MinInt(v, expected int) Fend
- func MinInt8(v, expected int8) Fend
- func MinInt8s(v []int8, expected int) Fend
- func MinInt32(v, expected int32) Fend
- func MinInt32s(v []int32, expected int) Fend
- func MinInt64(v, expected int64) Fend
- func MinInt64s(v []int64, expected int) Fend
- func MinInts(v []int, expected int) Fend
- func MinString(v string, expected int) Fend
- func MinStrings(v []string, expected int) Fend
- func MinUInt(v, expected uint) Fend
- func MinUInt8(v, expected uint8) Fend
- func MinUInt8s(v []uint8, expected int) Fend
- func MinUInt32(v, expected uint32) Fend
- func MinUInt32s(v []uint32, expected int) Fend
- func MinUInt64(v, expected uint64) Fend
- func MinUInt64s(v []uint64, expected int) Fend
- func MinUInts(v []uint, expected int) Fend
- func Regex(v string, regexp *regexp.Regexp) Fend
- func RequiredFloat32(v float32) Fend
- func RequiredFloat32s(v []float32) Fend
- func RequiredFloat64(v float64) Fend
- func RequiredFloat64s(v []float64) Fend
- func RequiredInt(v int) Fend
- func RequiredInt8(v int8) Fend
- func RequiredInt8s(v []int8) Fend
- func RequiredInt32(v int32) Fend
- func RequiredInt32s(v []int32) Fend
- func RequiredInt64(v int64) Fend
- func RequiredInt64s(v []int64) Fend
- func RequiredInts(v []int) Fend
- func RequiredString(v string) Fend
- func RequiredStrings(v []string) Fend
- func RequiredUInt(v uint) Fend
- func RequiredUInt8(v uint8) Fend
- func RequiredUInt8s(v []uint8) Fend
- func RequiredUInt32(v uint32) Fend
- func RequiredUInt32s(v []uint32) Fend
- func RequiredUInt64(v uint64) Fend
- func RequiredUInt64s(v []uint64) Fend
- func RequiredUInts(v []uint) Fend
- func SizeFloat32(v, expected float32) Fend
- func SizeFloat32s(v []float32, expected int) Fend
- func SizeFloat64(v, expected float64) Fend
- func SizeFloat64s(v []float64, expected int) Fend
- func SizeInt(v, expected int) Fend
- func SizeInt8(v, expected int8) Fend
- func SizeInt8s(v []int8, expected int) Fend
- func SizeInt32(v, expected int32) Fend
- func SizeInt32s(v []int32, expected int) Fend
- func SizeInt64(v, expected int64) Fend
- func SizeInt64s(v []int64, expected int) Fend
- func SizeInts(v []int, expected int) Fend
- func SizeString(v string, expected int) Fend
- func SizeStrings(v []string, expected int) Fend
- func SizeUInt(v, expected uint) Fend
- func SizeUInt8(v, expected uint8) Fend
- func SizeUInt8s(v []uint8, expected int) Fend
- func SizeUInt32(v, expected uint32) Fend
- func SizeUInt32s(v []uint32, expected int) Fend
- func SizeUInt64(v, expected uint64) Fend
- func SizeUInt64s(v []uint64, expected int) Fend
- func SizeUInts(v []uint, expected int) Fend
- type FieldError
- type Fields
- type FieldsError
- type FieldsErrorMap
- type FieldsErrors
- type FieldsErrorsMap
- type RequiredError
- type Rule
- type RuleError
- func NewFendEmailError() *RuleError
- func NewFendEnumError() *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
- func NewRuleError(fend Rule, meta ...string) *RuleError
Constants ¶
View Source
const ( DefaultRuleDelimiter = ";" DefaultFieldDelimiter = ":" DefaultMetaDelimiter = "|" DefaultErrorDelimiter = "," )
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 ( FieldDelimiter = DefaultFieldDelimiter RuleDelimiter = DefaultRuleDelimiter ErrorDelimiter = DefaultErrorDelimiter MetaDelimiter = DefaultMetaDelimiter )
Functions ¶
This section is empty.
Types ¶
type Enumerator ¶
type Enumerator interface {
Valid() bool
}
type Fend ¶ added in v0.2.1
type Fend func() *RuleError
func EmailRFC5322 ¶
EmailRFC5322 validation using RFC5322 regex
func Enum ¶
func Enum(v Enumerator) Fend
func MaxFloat32 ¶
func MaxFloat32s ¶
func MaxFloat64 ¶
func MaxFloat64s ¶
func MaxStrings ¶
func MaxUInt32s ¶
func MaxUInt64s ¶
func MinFloat32 ¶
func MinFloat32s ¶ added in v0.2.1
func MinFloat64 ¶
func MinFloat64s ¶ added in v0.2.1
func MinStrings ¶ added in v0.2.1
func MinUInt32s ¶ added in v0.2.1
func MinUInt64s ¶ added in v0.2.1
func RequiredFloat32 ¶
func RequiredFloat32s ¶ added in v0.2.1
func RequiredFloat64 ¶
func RequiredFloat64s ¶ added in v0.2.1
func RequiredInt ¶
func RequiredInt8 ¶
func RequiredInt8s ¶ added in v0.2.1
func RequiredInt32 ¶
func RequiredInt32s ¶ added in v0.2.1
func RequiredInt64 ¶
func RequiredInt64s ¶ added in v0.2.1
func RequiredInts ¶ added in v0.2.1
func RequiredString ¶
func RequiredStrings ¶
func RequiredUInt ¶ added in v0.2.1
func RequiredUInt8 ¶ added in v0.2.1
func RequiredUInt8s ¶ added in v0.2.1
func RequiredUInt32 ¶ added in v0.2.1
func RequiredUInt32s ¶ added in v0.2.1
func RequiredUInt64 ¶ added in v0.2.1
func RequiredUInt64s ¶ added in v0.2.1
func RequiredUInts ¶ added in v0.2.1
func SizeFloat32 ¶
func SizeFloat32s ¶ added in v0.2.1
func SizeFloat64 ¶
func SizeFloat64s ¶ added in v0.2.1
func SizeInt32s ¶ added in v0.2.1
func SizeInt64s ¶ added in v0.2.1
func SizeString ¶
func SizeStrings ¶
func SizeUInt8s ¶ added in v0.2.1
func SizeUInt32 ¶ added in v0.2.1
func SizeUInt32s ¶ added in v0.2.1
func SizeUInt64 ¶ added in v0.2.1
func SizeUInt64s ¶ added in v0.2.1
type FieldError ¶ added in v0.2.1
FieldError type
func NewFieldError ¶ added in v0.2.1
func NewFieldError(field string, err *RuleError) *FieldError
NewFieldError constructor
type Fields ¶
type Fields struct {
// contains filtered or unexported fields
}
Fields type
func (Fields) AllFieldsErrors ¶ added in v0.2.1
func (f Fields) AllFieldsErrors() FieldsErrorsMap
AllFieldsErrors return all fields errors
func (Fields) AllFieldsFirstError ¶ added in v0.2.1
func (f Fields) AllFieldsFirstError() FieldsErrorMap
AllFieldsFirstError returns only the first error on all fields
func (Fields) FirstFieldError ¶ added in v0.2.1
FirstFieldError returns only the first error
type FieldsErrorMap ¶ added in v0.2.1
FieldsErrorMap type
func (FieldsErrorMap) Error ¶ added in v0.2.1
func (m FieldsErrorMap) Error() error
Error returns a std error if not empty
func (FieldsErrorMap) String ¶ added in v0.2.1
func (m FieldsErrorMap) String() string
type FieldsErrors ¶
type FieldsErrors struct {
Map FieldsErrorsMap
}
FieldsErrors type
func NewFieldsErrors ¶
func NewFieldsErrors(m FieldsErrorsMap) *FieldsErrors
NewFieldsErrors constructor
type FieldsErrorsMap ¶ added in v0.2.1
FieldsErrorsMap type
func (FieldsErrorsMap) Error ¶ added in v0.2.1
func (m FieldsErrorsMap) Error() error
Error returns a std error if not empty
func (FieldsErrorsMap) String ¶ added in v0.2.1
func (m FieldsErrorsMap) String() string
String interface
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
func NewRuleError ¶ added in v0.2.1
NewRuleError constructor
Click to show internal directories.
Click to hide internal directories.