Documentation ¶
Index ¶
- func RespondError(w http.ResponseWriter, err error)
- func RespondErrorMessage(w http.ResponseWriter, code int, message string)
- func RespondJSON(w http.ResponseWriter, status int, payload interface{})
- func RespondJSONWithXTotalCount(w http.ResponseWriter, status int, count int, payload interface{})
- func UnmarshalJSON(r *http.Request, target interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondError ¶
func RespondError(w http.ResponseWriter, err error)
RespondError returns a validation error else
func RespondErrorMessage ¶
func RespondErrorMessage(w http.ResponseWriter, code int, message string)
RespondErrorMessage makes the error response with payload as json format
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, status int, payload interface{})
RespondJSON makes the response with payload as json format
func RespondJSONWithXTotalCount ¶ added in v0.0.90
func RespondJSONWithXTotalCount(w http.ResponseWriter, status int, count int, payload interface{})
RespondJSONWithXTotalCount makes the response with payload as json format and adds X-Total-Count header
func UnmarshalJSON ¶
UnmarshalJSON checks for empty body and then parses JSON into the target
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.