typrest

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 8 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 DumpEcho added in v0.9.5

func DumpEcho(e *echo.Echo) []string

DumpEcho dump route in echo server

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 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]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