path

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 13 Imported by: 171

Documentation

Overview

Package path contains types that represent data references.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasRoot added in v0.6.1

func HasRoot(p, root Node) (res bool)

HasRoot returns true iff p starts with root, using equal as the node comparision function.

func ShallowEqual added in v0.6.1

func ShallowEqual(a, b Node) bool

ShallowEqual returns true if paths a and b are equal (ignoring parents).

Types

type Linker

type Linker interface {
	// Link returns the link to the pointee of this object at p.
	// If nil, nil is returned then the path cannot be followed.
	Link(ctx context.Context, p Node, r *ResolveConfig) (Node, error)
}

Linker is the interface implemented by types that can point to other objects.

type Node

type Node interface {
	// Parent returns the path that this path derives from.
	// If this path is a root, then Base returns nil.
	Parent() Node

	// SetParent sets the path that this derives from.
	SetParent(Node)

	// Path returns this path node as a path.
	Path() *Any

	// Validate checks the path for correctness, returning an error if any
	// issues are found.
	Validate() error
}

Node is the interface for types that represent a reference to a capture, command list, single command, memory, state or sub-object. A path can be passed between client and server using RPCs in order to describe some data in a capture.

func ToList

func ToList(n Node) []Node

ToList unchains the parents of each node, returning them as a list, starting with the root node.

func Transform added in v0.6.1

func Transform(n Node, f func(Node) Node) Node

Transform transforms each of the nodes in the chain using the function f.

Jump to

Keyboard shortcuts

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