Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadRequest = APIError{ StatusCode: http.StatusBadRequest, Type: "client-error", Error: "Default", Message: "Cannot process current request", Method: "Default", } ErrInvalidJSON = APIError{ StatusCode: http.StatusBadRequest, Type: "invalid-json", Error: "Default", Message: "Invalid or malformed JSON", Method: "Default", } ErrInternalServer = APIError{ StatusCode: http.StatusInternalServerError, Type: "server-error", Error: "Default", Message: "Internal server error", Method: "Default", } )
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type ResponseAPI ¶
type ResponseAPI struct { Success bool `json:"success"` Status int `json:"status,omitempty"` Result interface{} `json:"result,omitempty"` }
func Success ¶
func Success(result interface{}, status int) *ResponseAPI
func (*ResponseAPI) Send ¶
func (r *ResponseAPI) Send(w http.ResponseWriter) error
Click to show internal directories.
Click to hide internal directories.