trie

package
v0.0.0-...-8cda547 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Special Trie implementation for the URLRouter.

This Trie implementation is designed to support strings that includes :param and *splat parameters. Strings that are commonly used for URL routing. You probably don't need to use this package directly.

Example:

TBD

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	// same Route as in node
	Route interface{}
	// map of params matched for this result
	Params map[string]string
}

type Trie

type Trie struct {
	// contains filtered or unexported fields
}

func New

func New() *Trie

Instanciate a Trie with an empty node as the root.

func (*Trie) AddRoute

func (self *Trie) AddRoute(path string, route interface{}) error

Insert the route in the Trie following or creating the nodes corresponding to the path.

func (*Trie) Compress

func (self *Trie) Compress()

Reduce the size of the tree, must be done after the last AddRoute.

func (*Trie) FindRoutes

func (self *Trie) FindRoutes(path string) []*Match

Given a path, return all the matchin routes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL