Documentation ¶
Index ¶
- Variables
- func Validate(t ValidationType, rules Rules, r io.Reader) error
- type Rule
- type RuleElement
- func Array() RuleElement
- func Base32() RuleElement
- func Base64() RuleElement
- func Boolean() RuleElement
- func BooleanString() RuleElement
- func Contains(str string) RuleElement
- func DivisibleBy(number float64) RuleElement
- func Email() RuleElement
- func Empty() RuleElement
- func Equals(value any) RuleElement
- func Float() RuleElement
- func FloatString() RuleElement
- func If(ruleElement RuleElement) RuleElement
- func IfNot(ruleElement RuleElement) RuleElement
- func Integer() RuleElement
- func IntegerString() RuleElement
- func Length(min, max int) RuleElement
- func Max(maxNumber float64) RuleElement
- func MaxLength(max int) RuleElement
- func Min(minNumber float64) RuleElement
- func MinLength(min int) RuleElement
- func Negative() RuleElement
- func NotContains(str string) RuleElement
- func NotEmpty() RuleElement
- func NotEquals(value any) RuleElement
- func NotNull() RuleElement
- func OnlyASCII() RuleElement
- func OnlyAlpha() RuleElement
- func OnlyAlphanumeric() RuleElement
- func Positive() RuleElement
- func String() RuleElement
- type RuleElementParameter
- type Rules
- type ValidationError
- type ValidationErrors
- type ValidationType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidValidationType = errors.New("invalid validation type")
)
Functions ¶
Types ¶
type Rule ¶
type Rule []RuleElement
type RuleElement ¶
type RuleElement func(p RuleElementParameter) ValidationError
func Array ¶
func Array() RuleElement
func Base32 ¶
func Base32() RuleElement
func Base64 ¶
func Base64() RuleElement
func Boolean ¶
func Boolean() RuleElement
func BooleanString ¶
func BooleanString() RuleElement
func Contains ¶
func Contains(str string) RuleElement
func DivisibleBy ¶
func DivisibleBy(number float64) RuleElement
func Email ¶
func Email() RuleElement
func Empty ¶
func Empty() RuleElement
func Equals ¶
func Equals(value any) RuleElement
func Float ¶
func Float() RuleElement
func FloatString ¶
func FloatString() RuleElement
func If ¶
func If(ruleElement RuleElement) RuleElement
func IfNot ¶
func IfNot(ruleElement RuleElement) RuleElement
func Integer ¶
func Integer() RuleElement
func IntegerString ¶
func IntegerString() RuleElement
func Length ¶
func Length(min, max int) RuleElement
func Max ¶
func Max(maxNumber float64) RuleElement
func MaxLength ¶
func MaxLength(max int) RuleElement
func Min ¶
func Min(minNumber float64) RuleElement
func MinLength ¶
func MinLength(min int) RuleElement
func Negative ¶
func Negative() RuleElement
func NotContains ¶
func NotContains(str string) RuleElement
func NotEmpty ¶
func NotEmpty() RuleElement
func NotEquals ¶
func NotEquals(value any) RuleElement
func NotNull ¶
func NotNull() RuleElement
func OnlyASCII ¶
func OnlyASCII() RuleElement
func OnlyAlpha ¶
func OnlyAlpha() RuleElement
func OnlyAlphanumeric ¶
func OnlyAlphanumeric() RuleElement
func Positive ¶
func Positive() RuleElement
func String ¶
func String() RuleElement
type RuleElementParameter ¶
type ValidationError ¶
type ValidationError struct { Field string Message string // contains filtered or unexported fields }
func NewValidationError ¶
func NewValidationError(field, message string, args ...any) ValidationError
func NilValidationError ¶
func NilValidationError() ValidationError
func (ValidationError) Error ¶
func (err ValidationError) Error() string
func (ValidationError) Nil ¶
func (err ValidationError) Nil() bool
type ValidationErrors ¶
type ValidationErrors []ValidationError
func (ValidationErrors) Error ¶
func (err ValidationErrors) Error() string
Click to show internal directories.
Click to hide internal directories.