Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(cfg Config) echo.MiddlewareFunc
Middleware returns an echo.MiddlewareFunc for the echo server cfg is the Config of the middleware
Types ¶
type Config ¶
type Config struct { PathMapping PathItems DefaultValidation ValidationFunc }
Config is the middleware configuration. PathMapping contains a list of validation functions, grouped by path and method. DefaultValidation is the default validation action taken if no mapping is matched
type PathItem ¶
type PathItem struct { Methods ValidationMap Patterns Patterns PathValidation ValidationFunc }
PathItem is a validation item. Patterns is a list of URL patterns to which this validation PathItem responds to Methods is a list of mappings based on methods. This can be NIL. PathValidation is the default validation for this path, if all Methods validations did not find a match
func (PathItem) FindMethodValidator ¶
func (i PathItem) FindMethodValidator(method string) ValidationFunc
FindMethodValidator looks for a method validator that matches the provided method. It will return NIL if Methods is NIL or if no method matchers are found
func (PathItem) MatchPattern ¶
MatchPattern will return true if a path pattern matches the provided path
type ValidationFunc ¶
type ValidationFunc func(c echo.Context) error
ValidationFunc is any function meant to validate access to a path or method
type ValidationMap ¶
type ValidationMap map[string]ValidationFunc
ValidationMap maps string keys to validation functions