Documentation
¶
Overview ¶
Package tree implements a tree structure.
Index ¶
- type Path
- type PathValue
- type Tree
- func (t *Tree) All(prefix Path) []PathValue
- func (t *Tree) Clone() *Tree
- func (t *Tree) Delete(p Path) (val interface{}, deleted bool)
- func (t *Tree) Load(p Path) (val interface{}, ok bool)
- func (t *Tree) LoadOrStore(p Path, val interface{}) (actual interface{}, loaded bool)
- func (t *Tree) Store(p Path, val interface{}) (old interface{}, replaced bool)
- func (t *Tree) Walk(prefix Path, f WalkFunc) error
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathValue ¶
type PathValue struct { Path Path Value interface{} }
PathValue represents a value stored at a certain path in the tree.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree structure storing values at paths. It is not safe for concurrent use by multiple goroutines without locking.
func (*Tree) Delete ¶
Delete deletes the value stored in the tree under the given path, if it exists. It returns the deleted value if it was deleted.
func (*Tree) LoadOrStore ¶
LoadOrStore returns the value stored in the tree under the given path, if it exists. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
Click to show internal directories.
Click to hide internal directories.