Documentation ¶
Index ¶
- type JSONError
- type JSONResponse
- func (jresp *JSONResponse) Data(data interface{}) *JSONResponse
- func (jresp *JSONResponse) Error(err error, errResp *JSONError) *JSONResponse
- func (jresp *JSONResponse) SetHeader(key, value string)
- func (jresp *JSONResponse) Write() (int, error)
- func (jresp *JSONResponse) WriteHeader(statusCode int) *JSONResponse
- type JSONRetryResponse
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONError ¶
type JSONError struct { Title string `json:"title"` Message string `json:"message"` Detail string `json:"detail"` Errors []string `json:"errors"` }
JSONError struct for error field in json response
type JSONResponse ¶
type JSONResponse struct { // response part ResponseStatus Status `json:"status"` ResponseData interface{} `json:"data"` ResponseRetry *JSONRetryResponse `json:"retry,omitempty"` ResponseError *JSONError `json:"error,omitempty"` // contains filtered or unexported fields }
JSONResponse struct for http json response
func (*JSONResponse) Data ¶
func (jresp *JSONResponse) Data(data interface{}) *JSONResponse
Data for set data to json response
func (*JSONResponse) Error ¶
func (jresp *JSONResponse) Error(err error, errResp *JSONError) *JSONResponse
Error set error to json response only use error when the type of error is *xerrors.Error
func (*JSONResponse) SetHeader ¶
func (jresp *JSONResponse) SetHeader(key, value string)
SetHeader used to set header in http.ResponseWriter of JSONResponse
func (*JSONResponse) WriteHeader ¶
func (jresp *JSONResponse) WriteHeader(statusCode int) *JSONResponse
WriteHeader set the header of JSONResponse writer
type JSONRetryResponse ¶
JSONRetryResponse struct for retry field in json response
Click to show internal directories.
Click to hide internal directories.