Documentation ¶
Overview ¶
Special Trie implementation for HTTP routing.
This Trie implementation is designed to support strings that includes :param and *splat parameters. Strings that are commonly used to represent the Path in HTTP routing. This implementation also maintain for each Path a map of HTTP Methods associated with the Route.
You probably don't need to use this package directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
func (*Trie) AddRoute ¶
Insert the route in the Trie following or creating the nodes corresponding to the path.
func (*Trie) Compress ¶
func (t *Trie) Compress()
Reduce the size of the tree, must be done after the last AddRoute.
func (*Trie) FindRoutes ¶
Given a path and an http method, return all the matching routes.
func (*Trie) FindRoutesAndPathMatched ¶
Same as FindRoutes, but return in addition a boolean indicating if the path was matched. Useful to return 405
func (*Trie) FindRoutesForPath ¶
Given a path, and whatever the http method, return all the matching routes.