Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	// Basic metadata
	HTTPStatusCode int    `json:"code"`
	RequestID      string `json:"request_id,omitempty"`

	// Message is included in all responses, and is a summary of the server's response
	Message string `json:"message"`

	// Err contains additional context in the event of an error
	Err string `json:"error,omitempty"`

	// Data contains information the server wants to return
	Data interface{} `json:"data,omitempty"`
}

    Response is the underlying response structure to all responses.

    func NewResponse

    func NewResponse(
    	message string,
    	code int,
    	kvs []interface{},
    ) *Response

      NewResponse creates an instance of the standard basic response renderer

      func (*Response) Error

      func (b *Response) Error() error

        Error returns a summary of an encountered error. For more details, you may want to interrogate Data. Returns nil if StatusCode is not an HTTP error code, ie if the code is in 1xx, 2xx, or 3xx

        func (*Response) Render

        func (b *Response) Render(w http.ResponseWriter, r *http.Request) error

          Render implements chi's render.Renderer

          Source Files