common

package
v0.0.0-...-5f382f4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLimitAndOffset

func GetLimitAndOffset(urlQuery url.Values) (_, _ int, extErr exterrors.ExtError)

GetLimitAndOffset returns limit and offset from query parameters.

func ProcessRequestBody

func ProcessRequestBody(w http.ResponseWriter, r *http.Request, body interface{}) error

ProcessRequestBody unmarshal and validate request body and sends errors if any.

func SendExtError

func SendExtError(w http.ResponseWriter, extError exterrors.ExtError)

SendExtError sends extError with code selected based on the ErrorCode.

func SendExtErrors

func SendExtErrors(w http.ResponseWriter, code int, httpErrors exterrors.ExtErrors)

SendExtError sends extErrors.

func SendRawResponse

func SendRawResponse(w http.ResponseWriter, statusCode int, binBody []byte)

SendRawResponse sends any raw ([]byte) response.

func SendResponse

func SendResponse(w http.ResponseWriter, statusCode int, respBody interface{})

SendResponse - encode response to json and send it.

func UnmarshalRequestBody

func UnmarshalRequestBody(r *http.Request, body interface{}) exterrors.ExtError

UnmarshalRequestBody unmarshals request body.

func ValidateRequestBody

func ValidateRequestBody(r *http.Request, body interface{}) exterrors.ExtErrors

ValidateRequestBody uses validator to validate request body.

Types

This section is empty.

Jump to

Keyboard shortcuts

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