Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandlerToJSONEndpoint ¶
func HandlerToJSONEndpoint(h Handler) server.JSONEndpoint
HandlerToJSONEndpoint converts a handler to a proper Gizmo JSONEndpoint.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { // the error message // // in: body Message string `json:"error"` // contains filtered or unexported fields }
ErrorResponse represents the basic error returned by the API on operation failures.
swagger:response genericError
func NewErrorResponse ¶
func NewErrorResponse(err error) *ErrorResponse
NewErrorResponse creates a new ErrorResponse with the given error. The default status code for error responses is 500 (InternalServerError). Use the method WithError to customize it.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Error returns the underlying error message.
func (*ErrorResponse) Result ¶
func (r *ErrorResponse) Result() (int, interface{}, error)
Result ensures that ErrorResponse implements the interface Handler.
func (*ErrorResponse) WithStatus ¶
func (r *ErrorResponse) WithStatus(status int) *ErrorResponse
WithStatus creates a new copy of ErrorResponse using the given status.
type GizmoJSONResponse ¶
GizmoJSONResponse represents a response type that can be converted to Gizmo's JSONEndpoint result format.
type Handler ¶
type Handler func(*http.Request) GizmoJSONResponse
Handler represents a function that receives an HTTP request and returns a GizmoJSONResponse. It's a Gizmo JSONEndpoint structured for goswagger's annotation.