Documentation
¶
Index ¶
- Variables
- func NewRequestErrorsBodyData(requestErrors ...RequestError) *map[string]*[]string
- type FieldError
- type HeaderError
- type JSendBody
- type ParameterError
- type RequestError
- type Response
- func NewDebugErrorResponse(err error, debugErr error, data interface{}, errorCode *int, httpStatus int) *Response
- func NewDebugFailResponse(data interface{}, debugData interface{}, errorCode *int, httpStatus int) *Response
- func NewDebugSuccessResponse(data interface{}, debugData interface{}, httpStatus int) *Response
- func NewErrorResponse(err error, data interface{}, errorCode *int, httpStatus int) *Response
- func NewFailResponse(data interface{}, errorCode *int, httpStatus int) *Response
- func NewSuccessResponse(data interface{}, httpStatus int) *Response
Constants ¶
This section is empty.
Variables ¶
var (
ErrNilResponse = errors.New("response cannot be nil")
)
Functions ¶
func NewRequestErrorsBodyData ¶ added in v0.5.26
func NewRequestErrorsBodyData( requestErrors ...RequestError, ) *map[string]*[]string
NewRequestErrorsBodyData creates a new request errors body data
Types ¶
type FieldError ¶ added in v0.5.22
FieldError struct
func NewFieldError ¶ added in v0.5.22
func NewFieldError( field, err string, ) *FieldError
NewFieldError creates a new field error
func (*FieldError) Error ¶ added in v0.5.24
func (f *FieldError) Error() string
Error returns the field error as a string
func (*FieldError) Key ¶ added in v0.5.26
func (f *FieldError) Key() string
Key returns the field name
type HeaderError ¶ added in v0.5.26
HeaderError struct
func NewHeaderError ¶ added in v0.5.26
func NewHeaderError( header, err string, ) *HeaderError
NewHeaderError creates a new header error
func (*HeaderError) Error ¶ added in v0.5.26
func (h *HeaderError) Error() string
Error returns the header error as a string
func (*HeaderError) Key ¶ added in v0.5.26
func (h *HeaderError) Key() string
Key returns the header name
type JSendBody ¶ added in v0.5.17
type JSendBody struct {
Status string `json:"status"`
Data interface{} `json:"data"`
Message *string `json:"message,omitempty"`
Code *int `json:"code,omitempty"`
}
JSendBody struct
func NewJSendErrorBody ¶ added in v0.5.17
NewJSendErrorBody creates a new error response body
func NewJSendFailBody ¶ added in v0.5.17
NewJSendFailBody creates a new fail response body
func NewJSendSuccessBody ¶ added in v0.5.17
func NewJSendSuccessBody(
data interface{},
) *JSendBody
NewJSendSuccessBody creates a new success response body
type ParameterError ¶ added in v0.5.26
ParameterError struct
func NewParameterError ¶ added in v0.5.26
func NewParameterError( parameter, err string, ) *ParameterError
NewParameterError creates a new parameter error
func (*ParameterError) Error ¶ added in v0.5.26
func (p *ParameterError) Error() string
Error returns the parameter error as a string
func (*ParameterError) Key ¶ added in v0.5.26
func (p *ParameterError) Key() string
Key returns the parameter name
type RequestError ¶ added in v0.5.26
RequestError struct
type Response ¶ added in v0.3.0
type Response struct {
// contains filtered or unexported fields
}
Response struct
func NewDebugErrorResponse ¶ added in v0.4.6
func NewDebugErrorResponse( err error, debugErr error, data interface{}, errorCode *int, httpStatus int, ) *Response
NewDebugErrorResponse creates a new error response
func NewDebugFailResponse ¶ added in v0.5.0
func NewDebugFailResponse(
data interface{},
debugData interface{},
errorCode *int,
httpStatus int,
) *Response
NewDebugFailResponse creates a new fail response
func NewDebugSuccessResponse ¶ added in v0.5.0
NewDebugSuccessResponse creates a new success response
func NewErrorResponse ¶
NewErrorResponse creates a new error response
func NewFailResponse ¶ added in v0.5.0
NewFailResponse creates a new fail response
func NewSuccessResponse ¶ added in v0.5.0
NewSuccessResponse creates a new success response
func (*Response) GetBody ¶ added in v0.5.17
func (r *Response) GetBody(mode *goflagsmode.Flag) interface{}
GetBody returns the response body
func (*Response) GetHTTPStatus ¶ added in v0.5.17
GetHTTPStatus returns the HTTP status