Documentation
¶
Index ¶
- Variables
- func Walk(r *Router, use func(*WalkerNode) error) error
- type MetaData
- type Node
- type PathInfo
- type PathVar
- type Router
- func (r *Router) Connect(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Delete(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Get(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Group(pattern string, use func(*Router)) *Router
- func (r *Router) Head(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Method(method, pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Options(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Patch(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Post(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Put(pattern string, fn T, options ...RoutingOption) *Node
- func (r *Router) Trace(pattern string, fn T, options ...RoutingOption) *Node
- type RoutingOption
- type T
- type WalkerNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnexpectedType = fmt.Errorf("unexpected-type") ErrMismatchNumberOfVariables = fmt.Errorf("mismatch-number-of-variables") )
Functions ¶
Types ¶
type MetaData ¶
type MetaData struct {
Method string
Path string
ExtraDependencies []interface{}
Parent *MetaData
// additional
Name string // if not renamed, the value is ""
Description string
DefaultStatusCode int // if 0 -> 200
Tags []string
}
func GetMetaData ¶
type Node ¶
type Node = pathpattern.Node
type PathInfo ¶
type PathVar ¶
type PathVar struct {
Name string // not argname (e.g. /{articleId} and func(articleID string) { ... })
Regex string
Shape reflectshape.Shape
}
type Router ¶
type Router struct {
Root *Node
ErrorHandler func(error)
Parent *Router // []*Router?
MetaData *MetaData
FullPrefix string
// contains filtered or unexported fields
}
func (*Router) Connect ¶
func (r *Router) Connect(pattern string, fn T, options ...RoutingOption) *Node
func (*Router) Delete ¶
func (r *Router) Delete(pattern string, fn T, options ...RoutingOption) *Node
func (*Router) Method ¶
func (r *Router) Method(method, pattern string, fn T, options ...RoutingOption) *Node
type RoutingOption ¶
func WithAnotherHandlerName ¶
func WithAnotherHandlerName(name string) RoutingOption
func WithDefaultStatusCode ¶
func WithDefaultStatusCode(code int) RoutingOption
func WithExtraDependencies ¶
func WithExtraDependencies(deps ...interface{}) RoutingOption
func WithTags ¶
func WithTags(tags ...string) RoutingOption
type WalkerNode ¶
type WalkerNode struct {
Node *Node
History []pathpattern.Suffix
}
func (*WalkerNode) Path ¶
func (n *WalkerNode) Path() []string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pathpattern implements path matching.
|
Package pathpattern implements path matching. |
Click to show internal directories.
Click to hide internal directories.