Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code APIErrorCode `json:"code"` Message string `json:"message"` ValidationErrors validation.Errors `json:"validation_errors"` }
func NewAPIError ¶
func NewAPIError(code APIErrorCode, err error) *APIError
func NewAPIValidationError ¶
func NewAPIValidationError(code APIErrorCode, valErrs validation.Errors) *APIError
func (*APIError) GetHTTPStatusCode ¶
type APIErrorCode ¶
type APIErrorCode string
const ( CodeBadRequest APIErrorCode = "bad_request" CodeForbidden APIErrorCode = "forbidden" CodeNotFound APIErrorCode = "not_found" CodeInternalServerError APIErrorCode = "internal_server_error" CodeValidationFailed APIErrorCode = "validation_failed" )
type APIResponse ¶
type APIResponse struct { Error *APIError `json:"error"` Data interface{} `json:"data"` }
func NewAPIResponse ¶
func NewAPIResponse(err error, data interface{}) *APIResponse
type RequestValidator ¶
type RequestValidator struct{}
func (*RequestValidator) Validate ¶
func (*RequestValidator) Validate(i interface{}) error
Click to show internal directories.
Click to hide internal directories.