trie

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package trie implements a in-memory trie tree. Reference: Trie - Wikipedia, the free encyclopedia

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trie

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

Trie is the trie tree.

func New

func New(delim string) *Trie

New creates a new Trie.

func (*Trie) Clear

func (tr *Trie) Clear()

Clear the trie.

func (*Trie) Get

func (tr *Trie) Get(key string) interface{}

Get an item from the trie.

func (*Trie) Has

func (tr *Trie) Has(key string) bool

Has checks if an item is in trie. Returns true if the given key is in the trie.

func (*Trie) Len

func (tr *Trie) Len() int

Len returns the trie length.

func (*Trie) Map

func (tr *Trie) Map() map[string]interface{}

Map returns the full trie as a map.

func (*Trie) Match

func (tr *Trie) Match(pattern string) map[string]interface{}

Match a wildcard like pattern in the trie, the pattern is not a traditional wildcard, only "*" is supported.

func (*Trie) Pop

func (tr *Trie) Pop(key string) interface{}

Pop an item from the trie. Returns nil if the given key is not in the trie.

func (*Trie) Put

func (tr *Trie) Put(key string, value interface{})

Put an item to the trie.

Jump to

Keyboard shortcuts

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