trie

package
v0.0.0-...-e2b9e53 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

README

go test -cpuprofile cpu.prof -bench=.

go test -memprofile mem.prof -bench=.

go tool pprof cpu.prof

go tool pprof --alloc_space mem.prof

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MethodHandler

type MethodHandler struct {
	Method  string
	Handler http.Handler
}

MethodHandler keeps HTTP Method and http.handler

type Trie

type Trie struct {
	Handler     []MethodHandler
	HasCatchall bool
	HasRegex    bool
	Node        []*Trie
	// contains filtered or unexported fields
}

Trie data structure

func (*Trie) Get

func (t *Trie) Get(path []string, version string) (trie *Trie, p []string, leaf bool, err error)

Get returns a node

func (*Trie) Set

func (t *Trie) Set(path []string, handler http.Handler, method, version string) error

Set adds a node (url part) to the Trie

Jump to

Keyboard shortcuts

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