trie

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RuneKeyFunc

func RuneKeyFunc(key string, pos int) (k string, next int)

Types

type KeyFunc

type KeyFunc func(key string, pos int) (string, int)

type Node

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

func (*Node) Children

func (n *Node) Children() []*Node

func (*Node) ElementKey

func (n *Node) ElementKey() string

func (*Node) Key

func (n *Node) Key() string

func (*Node) Value

func (n *Node) Value() interface{}

type Trie

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

func New

func New(keyFunc KeyFunc) *Trie

New creates a new trie tree with optional keyFunc

func (*Trie) Add

func (t *Trie) Add(key string, value interface{}) *Node

Add node

func (*Trie) Delete

func (t *Trie) Delete(key string) (toDel *Node, deleted bool)

func (*Trie) Get

func (t *Trie) Get(key string) (_ *Node, exact bool)

Jump to

Keyboard shortcuts

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