model

package
v4.11.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalid occurs when checks fails
	ErrInvalid = errors.New("invalid")

	// ErrUnauthorized occurs when authorization header is missing
	ErrUnauthorized = errors.New("unauthorized")

	// ErrForbidden occurs when authorization header is missing
	ErrForbidden = errors.New("forbidden")

	// ErrNotFound occurs when something is not found
	ErrNotFound = errors.New("not found")

	// ErrMethodNotAllowed occurs when method is not allowed
	ErrMethodNotAllowed = errors.New("method not allowed")

	// ErrInternalError occurs when shit happens
	ErrInternalError = errors.New("internal error")
)

Functions

func ChainMiddlewares

func ChainMiddlewares(handler http.Handler, middlewares ...Middleware) http.Handler

ChainMiddlewares chain middlewares call from last to first (so first item is the first called)

func ConcatError

func ConcatError(errs []error) error

ConcatError concat errors to a single string

func SafeParseDuration

func SafeParseDuration(name string, value string, defaultDuration time.Duration) time.Duration

SafeParseDuration parses given value into duration and fallback to a default value

func WrapForbidden added in v4.3.0

func WrapForbidden(err error) error

WrapForbidden wraps given error with forbidden err

func WrapInternal

func WrapInternal(err error) error

WrapInternal wraps given error with internal err

func WrapInvalid

func WrapInvalid(err error) error

WrapInvalid wraps given error with invalid err

func WrapMethodNotAllowed

func WrapMethodNotAllowed(err error) error

WrapMethodNotAllowed wraps given error with not method not allowed err

func WrapNotFound

func WrapNotFound(err error) error

WrapNotFound wraps given error with not found err

func WrapUnauthorized added in v4.3.0

func WrapUnauthorized(err error) error

WrapUnauthorized wraps given error with unauthorized err

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware describe a middleware in the net/http package form

type Pinger

type Pinger = func() error

Pinger describes a function to check liveness of app

Jump to

Keyboard shortcuts

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