index

package
v1.5.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOOP iterflag = iota
	STOP
)

Variables

View Source
var (
	ErrNodeNotFound = errors.New("Node not found")
)

Functions

This section is empty.

Types

type Element

type Element interface {
	// Returns the identifier of the node
	Self() string

	// Returns the string respresentation of the nodes parent (usually it's ID)
	Parent() string

	// Deep copy of the node
	Copy() Element
}

type Index

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

func NewIndex

func NewIndex() *Index

func (*Index) Delete

func (i *Index) Delete(nodeID string) (Element, error)

Delete deletes a leaf node

func (*Index) Get

func (i *Index) Get(nodeID string) (Element, error)

Get returns a Copy of the named node.

func (*Index) HasChildren

func (i *Index) HasChildren(nodeID string) (bool, error)

HasChildren returns whether a node has children or not

func (*Index) Insert

func (i *Index) Insert(n Element) error

Insert inserts a copy of the given node to the tree under the given parent.

func (*Index) List

func (i *Index) List() ([]Element, error)

Jump to

Keyboard shortcuts

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