Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents list of validators and is used to accumulate errors and return them as a single "error"
func (*Chain) AddAssertion ¶
AddAssertion adds assertion to the validation chain.
func (*Chain) AddValidator ¶
AddValidator adds validator to the validation chain.
type ChainOption ¶
type ChainOption func(*Chain)
ChainOption configures a validation chain at creation time.
func AllErrors ¶
func AllErrors() ChainOption
AllErrors sets whether a chain should return all errors.
func FailFast ¶
func FailFast() ChainOption
FailFast sets whether a chain should stop validation on first error.
type TCPAddressValidator ¶ added in v2.2.1
type TCPAddressValidator struct {
// contains filtered or unexported fields
}
TCPAddressValidator helps validate a TCP address
func NewTCPAddressValidator ¶ added in v2.2.1
func NewTCPAddressValidator(address string) *TCPAddressValidator
NewTCPAddressValidator creates an instance of TCPAddressValidator
func (*TCPAddressValidator) Validate ¶ added in v2.2.1
func (a *TCPAddressValidator) Validate() error
Validate implements validation.Validator.
type Validator ¶
type Validator interface {
Validate() error
}
Validator interface generalizes the validator implementations
func NewBooleanValidator ¶
NewBooleanValidator creates a new boolean validator that returns an error message if condition is false This validator will come handy when dealing with conditional validation
func NewConditionalValidator ¶
NewConditionalValidator creates a conditional validator, that runs the validator if the condition is true. This validator will help when performing data update
func NewEmptyStringValidator ¶
NewEmptyStringValidator creates a string a emptyString validator