utils

package
v0.0.0-...-bb5f922 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateValidationResponse

func CreateValidationResponse(fields map[string][]string) ([]byte, error)

CreateValidationResponse is a helper function that creates a http response using the a map of validation errors.

func GetEnv

func GetEnv(k, d string) string

GetEnv attempts to retrieve env variable from k being the key or returns d being the default value.

func ParseBody

func ParseBody(r *http.Request, x interface{})

ParseBody unmarshal's json body into interface type

func ValidateInputs

func ValidateInputs(set interface{}) (bool, map[string][]string)

ValidateInputs uses validator on interface to check each validation rule. If any fail it will then run through each and return a custom error message depending on which field was wrong.

Types

This section is empty.

Jump to

Keyboard shortcuts

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