edittree

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispose added in v1.14.0

func Dispose(e *EditTree)

Recursively reclaims the tree nodes that are part of this EditTree.

Types

type EditTree

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

Deletions are encoded with a nil value pointer.

func EditTreeFromPool added in v1.14.0

func EditTreeFromPool(term *ast.Term) *EditTree

Creates a new EditTree instance from the package-internal sync.Pool. Callers should call edittree.Dispose() to return the node when done.

func NewEditTree

func NewEditTree(term *ast.Term) *EditTree

Creates a new EditTree node from term.

func (*EditTree) Delete

func (e *EditTree) Delete(key *ast.Term) (*EditTree, error)

Delete removes a child of e, or else creates a delete node for a term already present in e. It then returns the deleted child EditTree node.

func (*EditTree) DeleteAtPath

func (e *EditTree) DeleteAtPath(path ast.Ref) (*EditTree, error)

DeleteAtPath traverses down the tree from e and uses the last path segment as the key to delete a node from the tree. Returns the deleted EditTree node.

func (*EditTree) Exists

func (e *EditTree) Exists(path ast.Ref) bool

func (*EditTree) Filter

func (e *EditTree) Filter(paths []ast.Ref) *ast.Term

Filter pulls out only the values selected by paths. This is done recursively by plucking off one level from the paths each time we descend a level. Note: Values pulled from arrays will have the same approximate ordering in the final term.

func (*EditTree) Insert

func (e *EditTree) Insert(key, value *ast.Term) (*EditTree, error)

Insert creates a new child of e, and returns the new child EditTree node.

func (*EditTree) InsertAtPath

func (e *EditTree) InsertAtPath(path ast.Ref, value *ast.Term) (*EditTree, error)

InsertAtPath traverses down the tree from e and uses the last path segment as the key to insert value into the tree. Returns the inserted EditTree node.

func (*EditTree) Reclaim added in v1.18.0

func (e *EditTree) Reclaim() *EditTree

Reclaim is a recursive equivalent of Reset methods seen in other APIs.

func (*EditTree) Render

func (e *EditTree) Render() *ast.Term

Render generates the effective value for the term at e by recursively rendering the children of e, and then copying over any leftover keys from the original term stored at e.

func (*EditTree) RenderAtPath

func (e *EditTree) RenderAtPath(path ast.Ref) (*ast.Term, error)

RenderAtPath traverses down the tree from e and renders the EditTree node at the end of path.

func (*EditTree) String

func (e *EditTree) String() string

func (*EditTree) Unfold

func (e *EditTree) Unfold(path ast.Ref) (*EditTree, error)

Unfurls a chain of EditTree nodes down a given path, or else returns an error.

Directories

Path Synopsis
Package bitvector provides the implementation of a variable sized compact vector of bits which supports lookups, sets, appends, insertions, and deletions.
Package bitvector provides the implementation of a variable sized compact vector of bits which supports lookups, sets, appends, insertions, and deletions.

Jump to

Keyboard shortcuts

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