model

package
v4.47.9 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 5 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 IsNil added in v4.36.0

func IsNil(i any) bool

IsNil check if an interface is nil or not.

func WrapError added in v4.29.7

func WrapError(err, wrapper error) error

WrapError wraps err with the given wrapper.

func WrapForbidden added in v4.3.0

func WrapForbidden(err error) error

WrapForbidden wraps given error with forbidden error.

func WrapInternal

func WrapInternal(err error) error

WrapInternal wraps given error with internal error.

func WrapInvalid

func WrapInvalid(err error) error

WrapInvalid wraps given error with invalid error.

func WrapMethodNotAllowed

func WrapMethodNotAllowed(err error) error

WrapMethodNotAllowed wraps given error with method not allowed error.

func WrapNotFound

func WrapNotFound(err error) error

WrapNotFound wraps given error with not found error.

func WrapUnauthorized added in v4.3.0

func WrapUnauthorized(err error) error

WrapUnauthorized wraps given error with unauthorized error.

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