helpers

package
v0.0.0-...-9bc149c Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentUser

func CurrentUser(r *http.Request) models.User

CurrentUser returns the user associated with the identity in the request context

func Err422

func Err422(reason string, w http.ResponseWriter)

Err422 writes an error in the standard format to the response body

func MarshalResponseBody

func MarshalResponseBody(w http.ResponseWriter, status int, response interface{}) error

MarshalResponseBody json encodes and object to a response body and sets the status code

func UnmarshalRequestBody

func UnmarshalRequestBody(body io.Reader, object interface{}) error

UnmarshalRequestBody decodes json from a request body into an object

func ValidateStruct

func ValidateStruct(unvalidated interface{}) error

ValidateStruct uses validator library to validate a struct

Types

This section is empty.

Jump to

Keyboard shortcuts

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