Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParseError ¶
type ParseError struct { Msg string `json:"message"` ErrCode response.ErrorCode `json:"code"` ErrData interface{} `json:"data"` }
ParseError struct defines the structure of the JSON parsing error
func (*ParseError) Code ¶
func (p *ParseError) Code() response.ErrorCode
func (*ParseError) Data ¶
func (p *ParseError) Data() interface{}
func (*ParseError) Message ¶
func (p *ParseError) Message() string
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader has functions to read, parse nad validate request data
func (*Reader) HandleParseError ¶
func (read *Reader) HandleParseError(err error) *ParseError
HandleParseError checks the type of the error in request parsing and writes an appropriate response
func (*Reader) ReadJSONAndValidate ¶
ReadJSONAndValidate reads a json request body into the given struct and the validates the struct data
type ValidationError ¶
type ValidationError struct {
ErrData []string `json:"data"`
}
ValidationError struct defines the structure of the Validation errors
func (*ValidationError) Code ¶
func (v *ValidationError) Code() response.ErrorCode
func (*ValidationError) Data ¶
func (v *ValidationError) Data() interface{}
func (*ValidationError) Message ¶
func (v *ValidationError) Message() string
Click to show internal directories.
Click to hide internal directories.