Documentation
¶
Overview ¶
Package validation implements structure validation parsing functionalities so that a normalized envelope can be obtained while validation the structure content.
Index ¶
Constants ¶
View Source
const ( // ID defines the id to be used // as the container registration id of a validation. ID = api.ID + ".validation" // UniversalTranslatorID defines the id to be used // as the container registration id of a universal translator. UniversalTranslatorID = ID + ".universal_translator" // TranslatorID defines the id to be used // as the container registration id of a translator. TranslatorID = ID + ".translator" // ParserID defines the id to be used // as the container registration id of an error parser instance. ParserID = ID + ".parser" )
View Source
const ( // EnvID defines the slate.api.validation package base environment variable name. EnvID = api.EnvID + "_VALIDATION" )
Variables ¶
View Source
var ( // ErrTranslatorNotFound @todo doc ErrTranslatorNotFound = fmt.Errorf("translator not found") )
View Source
var ( // Locale defines the default locale string to be used when // instantiating the translator. Locale = env.String(EnvID+"_LOCALE", "en") )
Functions ¶
This section is empty.
Types ¶
type IParser ¶
type IParser interface { Parse(val interface{}, errs validator.ValidationErrors) (*envelope.Envelope, error) AddError(e string, code int) }
IParser defines the interface to an error parsing object used to convert a validation error into an envelope error
type Provider ¶
type Provider struct{}
Provider @todo doc
type Validator ¶
Validator is a function type used to define a calling interface of function responsible to validate an instance of a structure and return an initialized response envelope with the founded error
func NewValidator ¶
NewValidator instantiates a new validation function
Click to show internal directories.
Click to hide internal directories.