Documentation
¶
Index ¶
- Variables
- func ApiContextMiddleWare() func(echo.HandlerFunc) echo.HandlerFunc
- func AuthedSkipper() func(echo.Context) bool
- func AuthedWithConfig(config AuthedConfig, cl AuthedContextLookup) echo.MiddlewareFunc
- func Config(c ApiContext) error
- func ErrorHandler(err error, c echo.Context)
- func Healthz(c ApiContext) error
- func InitRoutes(e *echo.Echo)
- func QParams(c echo.Context, required ...string) (map[string]string, error)
- type ApiContext
- type AuthedConfig
- type AuthedContextLookup
- type CommonExtendable
- type CommonLinkable
- type CommonMetable
- type Extendable
- type HandlerFunc
- type Linkable
- type Metable
- type MethodHandler
- type Route
- type RouteConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultAuthedConfig default Authed middleware config. DefaultAuthedConfig = AuthedConfig{ Skipper: AuthedSkipper(), } )
Functions ¶
func ApiContextMiddleWare ¶
func ApiContextMiddleWare() func(echo.HandlerFunc) echo.HandlerFunc
func AuthedSkipper ¶
func AuthedWithConfig ¶
func AuthedWithConfig(config AuthedConfig, cl AuthedContextLookup) echo.MiddlewareFunc
AuthedWithConfig ...
func Config ¶
func Config(c ApiContext) error
func Healthz ¶
func Healthz(c ApiContext) error
func InitRoutes ¶
Types ¶
type ApiContext ¶
type ApiContext interface {
echo.Context
Payload() *jsonapi.OnePayload
Attrs(permitted ...string) map[string]interface{}
AttrKeys() []string
RequireAttrs(...string) error
BindAndValidate(interface{}) error
BindMulti(interface{}) ([]interface{}, error)
BindIdParam(*int, ...string) error
JsonApi(interface{}, int) error
JsonApiOK(interface{}, ...interface{}) error
JsonApiOKPaged(interface{}, *meta.Pagination, ...interface{}) error
ApiError(string, ...int) *echo.HTTPError
JsonAPIError(string, int, string) *jsonapi.ErrorObject
QueryParamTrue(string) (bool, bool)
RequiredQueryParams(...string) (map[string]string, error)
OptionalQueryParams(...string) map[string]string
QParams(...string) (map[string]string, error)
}
type AuthedConfig ¶
AuthedConfig config for Authed middleware.
type AuthedContextLookup ¶
type CommonExtendable ¶
type CommonExtendable interface {
CommonExtend(interface{}) error
}
type CommonLinkable ¶
type CommonLinkable interface {
CommonLinks(*meta.Pagination) error
}
type CommonMetable ¶
type CommonMetable interface {
CommonMeta() error
}
type Extendable ¶
type Extendable interface {
Extend(interface{}) error
}
type HandlerFunc ¶
type HandlerFunc func(ApiContext) error
type Linkable ¶
type Linkable interface {
Links(*meta.Pagination) error
}
type MethodHandler ¶
type MethodHandler struct {
Method string
Handler echo.HandlerFunc
MiddleWare []echo.MiddlewareFunc
}
type Route ¶
type Route struct {
Path string
Handlers []*MethodHandler
Name string
ERoute *echo.Route
}
func RouteByName ¶
func (*Route) Handle ¶
func (route *Route) Handle(m string, hf HandlerFunc, mw ...echo.MiddlewareFunc) *Route
type RouteConfig ¶
type RouteConfig struct {
Routes []*Route
MiddleWare []echo.MiddlewareFunc
}
var Routing *RouteConfig
func (*RouteConfig) AddRoute ¶
func (config *RouteConfig) AddRoute(path string) *Route
Source Files
¶
Click to show internal directories.
Click to hide internal directories.