Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Fields is the fields flag Fields = "$fields" // Errors is the errors flag Errors = "$errors" )
var ( ErrNilJSONParsedValidations = errors.New("json parsed validations is nil") ErrNilParser = errors.New("mapper validations parser cannot be nil") )
Functions ¶
This section is empty.
Types ¶
type ErrorParser ¶
type ErrorParser struct{}
ErrorParser is the struct for the error parser
func NewErrorParser ¶
func NewErrorParser() *ErrorParser
NewErrorParser creates a new ErrorParser struct
func (*ErrorParser) GenerateFailedValidationsMessage ¶
func (e *ErrorParser) GenerateFailedValidationsMessage( validations govalidatorvalidations.Validations, level int, ) (*string, error)
GenerateFailedValidationsMessage returns a formatted error message for ErrorParser
func (*ErrorParser) GetLevelPadding ¶
func (e *ErrorParser) GetLevelPadding(level int) string
GetLevelPadding returns the padding for the level
func (*ErrorParser) ParseValidations ¶
func (e *ErrorParser) ParseValidations(validations govalidatorvalidations.Validations) ( interface{}, error, )
ParseValidations parses the validations and returns the failed validations message
type JSONParsedValidations ¶
type JSONParsedValidations struct { Fields *map[string]*JSONParsedValidations `json:"$fields,omitempty"` Errors *[]error `json:"$errors,omitempty"` }
JSONParsedValidations is a struct that holds the JSON parsed validations
func NewJSONParsedValidations ¶
func NewJSONParsedValidations() *JSONParsedValidations
NewJSONParsedValidations creates a new JSONParsedValidations struct
func (*JSONParsedValidations) AddErrors ¶
func (j *JSONParsedValidations) AddErrors(errors *[]error)
AddErrors adds errors to the JSON parsed validations
func (*JSONParsedValidations) AddFieldParsedValidations ¶
func (j *JSONParsedValidations) AddFieldParsedValidations( field string, fieldParsedValidations *JSONParsedValidations, )
AddFieldParsedValidations adds a field parsed validations to the JSON parsed validations
func (*JSONParsedValidations) GetFieldParsedValidations ¶
func (j *JSONParsedValidations) GetFieldParsedValidations(field string) *JSONParsedValidations
GetFieldParsedValidations returns the field parsed validations from the JSON parsed validations
type JSONParser ¶
type JSONParser struct{}
JSONParser is a struct that holds the JSON parser
func (*JSONParser) GenerateJSONParsedValidations ¶
func (j *JSONParser) GenerateJSONParsedValidations( validations govalidatorvalidations.Validations, jsonParsedValidations *JSONParsedValidations, ) error
GenerateJSONParsedValidations returns a
func (*JSONParser) ParseValidations ¶
func (j *JSONParser) ParseValidations(validations govalidatorvalidations.Validations) ( interface{}, error, )
ParseValidations parses the validations into JSON
type Parser ¶
type Parser interface { ParseValidations(validations govalidatorvalidations.Validations) ( interface{}, error, ) }
Parser is an interface to parse struct fields validations