Documentation ¶
Overview ¶
Package validation exposes members to ease the validation process. It is based upon the excellent go-playground/valdator.v9 package.
Index ¶
Constants ¶
const FailedErrCode = "ValidationFailed"
FailedErrCode error code constant for validation errors.
Variables ¶
var Validator = validator.New()
Validator instance exposed just in case you need more control over validation.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents a validation facility to ease the validation process by providing a Fluent like API.
func Validate ¶
Validate instantiate a new validation chain for the given resource. Then, you can use a fluent like API to constructs your validations and call Errors() to actually evaluates the chain.
func (*Chain) Errors ¶
Errors evaluates the entire chain and returns any errors as a DomainError containing FieldError as inner errors.
type FieldError ¶
type FieldError struct { Resource string `json:"resource"` Field string `json:"field"` Code string `json:"code"` }
FieldError represents a field error that has occured during the validation step.
func (*FieldError) Error ¶
func (err *FieldError) Error() string