pathtrie

package
v0.0.0-...-08a7446 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(a interface{}) bool

Types

type PathToTrieNode

type PathToTrieNode map[string]*TrieNode

type PathTrie

type PathTrie struct {
	Trie          PathToTrieNode
	PathSeparator string
}

func New

func New() PathTrie

func (*PathTrie) Insert

func (pt *PathTrie) Insert(computed string,
	url string,
	operation *openapi3.Operation,
	method string,
	val interface{}) bool

func (*PathTrie) InsertMerge

func (pt *PathTrie) InsertMerge(segments []string,
	urls []string,
	operations map[string]*openapi3.Operation,
	val interface{},
	merge ValueMergeFunc) (isNewPath bool)

func (*PathTrie) Nodes

func (pt *PathTrie) Nodes() []*TrieNode

func (*PathTrie) Print

func (pt *PathTrie) Print() string

type TrieNode

type TrieNode struct {
	Children PathToTrieNode

	// Name of the path segment corresponding to this node.
	// E.g. if this node represents /v1/foo/bar,
	// the Name would be "bar" and the Path would be "/v1/foo/bar".
	Name string

	// Path includes the node's name and uniquely identifies the node in the tree.
	Path string

	// URL as it was.
	URL string

	// Value of the full path
	Value interface{}

	// Operation
	Operations map[string]*openapi3.Operation
}

type ValueMergeFunc

type ValueMergeFunc func(existing, newV *interface{})

Jump to

Keyboard shortcuts

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