pathtree

package
v0.0.0-...-089673d Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node is a data structure, inspired by prefix tree, used for routing HTTP requests in the Event Gateway. It's used for creating tree structure of segments in HTTP paths. Each segments is stored in separate node.

func NewNode

func NewNode() *Node

NewNode creates new Node.

func (*Node) AddRoute

func (n *Node) AddRoute(route string, value interface{}) error

AddRoute adds route to the tree. This function will panic in case of adding conflicting parameterized paths. nolint: gocyclo

func (*Node) DeleteRoute

func (n *Node) DeleteRoute(route string) error

DeleteRoute deletes route from the tree. This function will panic in case of removing non-existing node.

func (*Node) Resolve

func (n *Node) Resolve(path string) (interface{}, Params)

Resolve takes request URL path and traverse the tree trying find corresponding route. nolint: gocyclo

type Params

type Params map[string]string

Params is array for URL parameter

Jump to

Keyboard shortcuts

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