Documentation
¶
Overview ¶
Package tree 提供了以树形结构保存路由项的相关操作。
Index ¶
- type Tree
- func (tree *Tree) Add(pattern string, h http.Handler, methods ...string) error
- func (tree *Tree) All(ignoreHead, ignoreOptions bool) map[string][]string
- func (tree *Tree) Clean(prefix string)
- func (tree *Tree) Handler(path string) (*handlers.Handlers, params.Params)
- func (tree *Tree) Print(w io.Writer)
- func (tree *Tree) Remove(pattern string, methods ...string)
- func (tree *Tree) SetAllow(pattern, allow string)
- func (tree *Tree) Trace(w io.Writer, path string)
- func (tree *Tree) URL(pattern string, params map[string]string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree 以树节点的形式保存的路由
多段路由项,会提取其中的相同的内容组成树状结构的节点。 比如以下路由项:
/posts/{id}/author /posts/{id}/author/emails /posts/{id}/author/profile /posts/1/author
会被转换成以下结构
/posts | +---- 1/author | +---- {id}/author | +---- /profile | +---- /emails
Click to show internal directories.
Click to hide internal directories.