trie

package
v0.0.0-...-03ea0d3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 2

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 defines a node in a trie.

func (*Node) AllValues

func (n *Node) AllValues() Values

AllValues returns all the values of the node and its child nodes.

type Trie

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

Trie defines a search tree based on runes.

func New

func New() *Trie

New creates a new trie.

func (*Trie) Autocomplete

func (t *Trie) Autocomplete(prefix string) Values

Autocomplete returns all the matching values of the prefix.

func (*Trie) Contains

func (t *Trie) Contains(s string) bool

Contains returns true if the string s is in the trie.

func (*Trie) Get

func (t *Trie) Get(s string) (*Value, bool)

Get gets a value for the string s.

func (*Trie) Match

func (t *Trie) Match(s string) bool

Match returns true if the string matches a rune path in the trie regardless whether the trie contains a corresponding value.

func (*Trie) Put

func (t *Trie) Put(name string, vals ...string)

Put adds values to the trie.

type Value

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

Value defines the value stored in the trie node.

func NewValue

func NewValue(name string, val string) *Value

NewValue creates a new value object.

func (Value) Name

func (v Value) Name() string

Name returns the name of the value object.

type Values

type Values []*Value

Values defines the slice of values.

func (Values) Sort

func (vs Values) Sort()

Sort sorts values in ascending order by name.

Jump to

Keyboard shortcuts

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