helpers

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationHeader = "Authorization"
View Source
const DateTimeUTCFormat = "2006-01-02 15:04 UTC"

Variables

View Source
var Config config
View Source
var Validate *validator.Validate

Functions

func Abort

func Abort(w http.ResponseWriter, statusCode int)

func AssertEqual

func AssertEqual(t *testing.T, a interface{}, b interface{})

func AssertStatus

func AssertStatus(t *testing.T, responseCode int, assertCode int)

func DecodeJsonRequest

func DecodeJsonRequest(r *http.Request, data interface{}) error

func EncodeJsonResponse

func EncodeJsonResponse(w http.ResponseWriter, statusCode int, data interface{}) error

func HashPassword

func HashPassword(password string) []byte

func LoggerMiddleware

func LoggerMiddleware(handler http.Handler) http.Handler

func PanicHandler

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

Types

type ErrorAbort

type ErrorAbort struct {
	// contains filtered or unexported fields
}

func (*ErrorAbort) Error

func (e *ErrorAbort) Error() string

type JSONTime

type JSONTime struct {
	time.Time
}

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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