Documentation ¶
Index ¶
- Constants
- func Failure(ctx *http.RequestCtx, contentType string, message []byte, statusCode int)
- func SendFailure(ctx *http.RequestCtx, resp *http.Response)
- func SendSuccess(ctx *http.RequestCtx, resp *http.Response)
- func Success(ctx *http.RequestCtx, contentType string, body []byte)
- type ContentFormatter
- type Error
- type JsonFormatter
- type ResponseFlag
- type ResponseState
- type TextFormatter
Constants ¶
View Source
const ( // response flag SUCCESS = responseutil.SUCCESS FAILURE = responseutil.FAILURE UNKNOWN = responseutil.UNKNOWN )
View Source
const ( CONTENT_TYPE_JSON string = "application/json; charset=utf-8" CONTENT_TYPE_TEXT string = "text/plain; charset=utf-8" )
View Source
const ( Json = JsonFormatter("") Text = TextFormatter("") )
Variables ¶
This section is empty.
Functions ¶
func Failure ¶
func Failure(ctx *http.RequestCtx, contentType string, message []byte, statusCode int)
func SendFailure ¶
func SendFailure(ctx *http.RequestCtx, resp *http.Response)
func SendSuccess ¶
func SendSuccess(ctx *http.RequestCtx, resp *http.Response)
Types ¶
type ContentFormatter ¶
type ContentFormatter interface { Success(ctx *http.RequestCtx, body interface{}) error Failure(ctx *http.RequestCtx, body interface{}, statusCode int) error }
type JsonFormatter ¶
type JsonFormatter string
func (JsonFormatter) Failure ¶
func (f JsonFormatter) Failure(ctx *http.RequestCtx, body interface{}, statusCode int) error
func (JsonFormatter) Success ¶
func (f JsonFormatter) Success(ctx *http.RequestCtx, body interface{}) error
type ResponseFlag ¶
type ResponseFlag = responseutil.ResponseFlag
type ResponseState ¶
type ResponseState = responseutil.ResponseState
func ExtractResponseState ¶
func ExtractResponseState(ctx *http.RequestCtx) ResponseState
type TextFormatter ¶
type TextFormatter string
func (TextFormatter) Failure ¶
func (f TextFormatter) Failure(ctx *http.RequestCtx, body interface{}, statusCode int) error
func (TextFormatter) Success ¶
func (f TextFormatter) Success(ctx *http.RequestCtx, body interface{}) error
Click to show internal directories.
Click to hide internal directories.