delve/vendor/github.com/derekparker/trie
2022-12-14 07:36:07 +01:00
..
.deepsource.toml pkg/terminal: Allow fuzzy searching tab completions (#2633) 2021-08-05 19:55:27 +02:00
.gitignore pkg/terminal: Allow fuzzy searching tab completions (#2633) 2021-08-05 19:55:27 +02:00
go.mod Update github.com/derekparker/trie dependency (#3219) 2022-12-14 07:36:07 +01:00
LICENSE pkg/terminal: Allow fuzzy searching tab completions (#2633) 2021-08-05 19:55:27 +02:00
README.md pkg/terminal: Allow fuzzy searching tab completions (#2633) 2021-08-05 19:55:27 +02:00
trie.go Update github.com/derekparker/trie dependency (#3219) 2022-12-14 07:36:07 +01:00

GoDoc

Trie

Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching.

Usage

Create a Trie with:

t := trie.New()

Add Keys with:

// Add can take in meta information which can be stored with the key.
// i.e. you could store any information you would like to associate with
// this particular key.
t.Add("foobar", 1)

Find a key with:

node, ok := t.Find("foobar")
meta := node.Meta()
// use meta with meta.(type)

Remove Keys with:

t.Remove("foobar")

Prefix search with:

t.PrefixSearch("foo")

Fast test for valid prefix:

t.HasKeysWithPrefix("foo")

Fuzzy search with:

t.FuzzySearch("fb")

Contributing

Fork this repo and run tests with:

go test

Create a feature branch, write your tests and code and submit a pull request.

License

MIT