Documentation
¶
Index ¶
- func JsonBytesWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, jsonBody []byte)
- func JsonStringWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, jsonBody string)
- func JsonStructWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, structToMarshal interface{})
- func JsonWithFailure(ctx *fasthttp.RequestCtx, httpCode int, errorCode string, errorMessage string, ...)
- func JsonWithFailureUsingErrorType(ctx *fasthttp.RequestCtx, errTy appError.Typ)
- type SingleMessageResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonBytesWithSuccess ¶
func JsonBytesWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, jsonBody []byte)
JsonBytesWithSuccess is supposed to set the response code and []byte body value in the context response
func JsonStringWithSuccess ¶
func JsonStringWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, jsonBody string)
JsonStringWithSuccess is supposed to set the response code and string body value in the context response The parameter `jsonBody` is supposed to be a valid json.
func JsonStructWithSuccess ¶
func JsonStructWithSuccess(ctx *fasthttp.RequestCtx, httpCode int, structToMarshal interface{})
func JsonWithFailure ¶
func JsonWithFailure(ctx *fasthttp.RequestCtx, httpCode int, errorCode string, errorMessage string, devMessage string)
JsonWithFailure is supposed to set a failure response code and other details
func JsonWithFailureUsingErrorType ¶
func JsonWithFailureUsingErrorType(ctx *fasthttp.RequestCtx, errTy appError.Typ)
Types ¶
type SingleMessageResponse ¶
type SingleMessageResponse struct {
Message string `json:"message"`
}
SingleMessageResponse is for sending a single message response to the client. Useful when just a single `200 OK` or `201 CREATED` would be ok but you still want to send a message to the client about what happened. e.g. "The blog post was created" or "The upload was successful" etc.
Click to show internal directories.
Click to hide internal directories.