Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct { // If enabled, the node handler could be updated Mutable bool // contains filtered or unexported fields }
Tree is a routes storage.
func (*Tree) Add ¶
func (t *Tree) Add(path string, handler fasthttp.RequestHandler)
Add adds a node with the given handle to the path.
WARNING: Not concurrency-safe!
func (*Tree) FindCaseInsensitivePath ¶
func (t *Tree) FindCaseInsensitivePath(path string, fixTrailingSlash bool, buf *bytebufferpool.ByteBuffer) bool
FindCaseInsensitivePath makes a case-insensitive lookup of the given path and tries to find a handler. It can optionally also fix trailing slashes. It returns the case-corrected path and a bool indicating whether the lookup was successful.
func (*Tree) Get ¶
func (t *Tree) Get(path string, ctx *fasthttp.RequestCtx) (fasthttp.RequestHandler, bool)
Get returns the handle registered with the given path (key). The values of param/wildcard are saved as ctx.UserValue. If no handle can be found, a TSR (trailing slash redirect) recommendation is made if a handle exists with an extra (without the) trailing slash for the given path.