Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPResponse ¶
type HTTPResponse struct { Success bool `json:"success"` Code int `json:"code"` Message string `json:"message"` Meta interface{} `json:"meta,omitempty"` Data interface{} `json:"data,omitempty"` Errors interface{} `json:"errors,omitempty"` }
HTTPResponse format
func NewHTTPResponse ¶
func NewHTTPResponse(code int, message string, params ...interface{}) *HTTPResponse
NewHTTPResponse for create common response
func (*HTTPResponse) JSON ¶
func (resp *HTTPResponse) JSON(w http.ResponseWriter) error
JSON for set http JSON response (Content-Type: application/json) with parameter is http response writer
func (*HTTPResponse) XML ¶
func (resp *HTTPResponse) XML(w http.ResponseWriter) error
XML for set http XML response (Content-Type: application/xml)
type WrapResponseWriter ¶
type WrapResponseWriter struct { StatusCode int http.ResponseWriter }
func NewWrapResponseWriter ¶
func NewWrapResponseWriter(res http.ResponseWriter) *WrapResponseWriter
func (WrapResponseWriter) Header ¶
func (w WrapResponseWriter) Header() http.Header
Satisfy the http.ResponseWriter interface
func (WrapResponseWriter) Status ¶
func (w WrapResponseWriter) Status() int
Give a way to get the status
func (WrapResponseWriter) Write ¶
func (w WrapResponseWriter) Write(data []byte) (int, error)
func (WrapResponseWriter) WriteHeader ¶
func (w WrapResponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.