helpers

package
v0.0.0-...-0cd45ec Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuthorization

func CheckAuthorization(r *http.Request, accessLevel int64) bool

CheckAuthorization checks whether logged in user is authorized to access specific page.

func ClientError

func ClientError(w http.ResponseWriter, status int)

ClientError logs status code of an erorr which occurred on the cliend side, and reeturns http.Error with associated status text.

func NewHelpers

func NewHelpers(a *config.AppConfig)

NewHelpers sets up app config for helpers

func ReadJSON

func ReadJSON(w http.ResponseWriter, r *http.Request, data interface{}) error

ReadJSON reads a single JSON value from a request body.

func ServerError

func ServerError(w http.ResponseWriter, err error)

ServerError logs stack trace of an erorr which occurred on the server side, and reeturns http.StatusInternalServerError status code as well as its associated status text.

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error

WriteJSON writes arbitrary data out as JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

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