model

package
v3.34.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

	// 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 ErrorStatus added in v3.34.1

func ErrorStatus(err error) (status int, message string)

ErrorStatus guess HTTP status and message from given error

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

Types

type Message

type Message struct {
	Level   string
	Content string
}

Message for render

func NewErrorMessage

func NewErrorMessage(content string) Message

NewErrorMessage create a error message

func NewSuccessMessage

func NewSuccessMessage(content string) Message

NewSuccessMessage create a success message

func ParseMessage

func ParseMessage(r *http.Request) Message

ParseMessage parses messages from request

func (Message) String added in v3.34.1

func (m Message) String() string

type TemplateFunc

type TemplateFunc = func(*http.Request) (string, int, map[string]interface{}, error)

TemplateFunc handle a request and returns which template to render with which status and datas

Jump to

Keyboard shortcuts

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