Documentation
¶
Overview ¶
Package pathtrie provides a minimal implementation of a trie where each node is a path component, allowing you to efficiently store metadata about a path-based structure and iterate over subtrees within said structure.
Index ¶
- type PathTrie
- func (t *PathTrie[V]) Delete(path string) (old V, found bool)
- func (t *PathTrie[V]) DeleteAll(path string) (old V, found bool)
- func (t *PathTrie[V]) Get(path string) (val V, found bool)
- func (t *PathTrie[V]) Set(path string, value V) (old V, found bool)
- func (t *PathTrie[V]) WalkFrom(path string, walkFn WalkFunc[V]) error
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathTrie ¶
type PathTrie[V any] struct { // contains filtered or unexported fields }
PathTrie represents a trie with each node being a path component.
func (*PathTrie[V]) Delete ¶
Delete removes the value at the given path, but any child entries are kept as-is. To remove the entry and all child entries use [DeleteAll]. If there was a value at the given path, the old value is returned and found will be true.
func (*PathTrie[V]) DeleteAll ¶
DeleteAll removes the entry at the given path and all child entries. To only delete the value at the path use [Delete]. If there was a value at the given path, the old value is returned and found will be true.
func (*PathTrie[V]) Get ¶
Get looks up the given path in the trie. Completely non-existent paths and paths with no value (such as intermediate paths) are considered the same.