render

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL