typrest

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HealthStatusOK = "OK"

HealthStatusOK is health status ok

View Source
var Stdout io.Writer = os.Stdout

Stdout standard output

Functions

func HTTPError

func HTTPError(err error) *echo.HTTPError

HTTPError convert error to *echo.HTTPError

func HealthStatus added in v0.9.1

func HealthStatus(m HealthMap) (healthy bool, details map[string]string)

HealthStatus of HealthCheck

func SetRoute added in v0.9.1

func SetRoute(server Server, routers ...Router)

SetRoute to server

Types

type EchoLogrus

type EchoLogrus struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

EchoLogrus is implementation of echo Logger

func WrapLogrus

func WrapLogrus(logger *logrus.Logger) *EchoLogrus

WrapLogrus logrus logger in echo log interface

func (*EchoLogrus) Debugj

func (l *EchoLogrus) Debugj(j log.JSON)

Debugj debug json log

func (*EchoLogrus) Errorj

func (l *EchoLogrus) Errorj(j log.JSON)

Errorj error json log

func (*EchoLogrus) Fatalj

func (l *EchoLogrus) Fatalj(j log.JSON)

Fatalj fatal json log

func (*EchoLogrus) Infoj

func (l *EchoLogrus) Infoj(j log.JSON)

Infoj info json log

func (*EchoLogrus) Level

func (l *EchoLogrus) Level() log.Lvl

Level returns logger level

func (*EchoLogrus) Output

func (l *EchoLogrus) Output() io.Writer

Output logger output func

func (*EchoLogrus) Panicj

func (l *EchoLogrus) Panicj(j log.JSON)

Panicj panic json log

func (*EchoLogrus) Prefix

func (l *EchoLogrus) Prefix() string

Prefix of echo logrus

func (*EchoLogrus) Printj

func (l *EchoLogrus) Printj(j log.JSON)

Printj print json log

func (*EchoLogrus) SetHeader

func (l *EchoLogrus) SetHeader(string)

SetHeader to set header (NOT SUPPORTED)

func (*EchoLogrus) SetLevel

func (l *EchoLogrus) SetLevel(lvl log.Lvl)

SetLevel set level to logger from given log.Lvl

func (*EchoLogrus) SetPrefix

func (l *EchoLogrus) SetPrefix(prefix string)

SetPrefix to set prefix

func (*EchoLogrus) Warnj

func (l *EchoLogrus) Warnj(j log.JSON)

Warnj warning json log

type Error

type Error interface {
	error
	HTTPError() *echo.HTTPError
}

Error interface

func NewError

func NewError(code int, message string) Error

NewError return error

func NotImplementedErr added in v0.8.38

func NotImplementedErr() Error

NotImplementedErr return not implemented error

type HealthMap added in v0.9.1

type HealthMap map[string]func() error

HealthMap to handle health-check

type Router

type Router interface {
	SetRoute(Server)
}

Router responsible to route

func NewRouter

func NewRouter(fn SetRouteFn) Router

NewRouter return new instance of Router

type Server

type Server interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	Any(path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) []*echo.Route
	Add(method, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	Match(methods []string, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) []*echo.Route
	Group(prefix string, m ...echo.MiddlewareFunc) *echo.Group
	Use(m ...echo.MiddlewareFunc)
}

Server interface for echo.Echo and echo.Group

type SetRouteFn

type SetRouteFn func(Server)

SetRouteFn function SetRoute

type ValidErr

type ValidErr struct {
	Message string
}

ValidErr validation error

func NewValidErr

func NewValidErr(message string) *ValidErr

NewValidErr create ValidationError

func (*ValidErr) Error

func (v *ValidErr) Error() string

func (*ValidErr) HTTPError

func (v *ValidErr) HTTPError() *echo.HTTPError

HTTPError return echo HTTP Error

Jump to

Keyboard shortcuts

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