query

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	IterAny       = nodes.IterAny
	PreOrder      = nodes.PreOrder
	PostOrder     = nodes.PostOrder
	LevelOrder    = nodes.LevelOrder
	ChildrenOrder = nodes.ChildrenOrder
	PositionOrder = ChildrenOrder + iota + 1
)

Variables

This section is empty.

Functions

func AllNodes

func AllNodes(it Iterator) []nodes.External

AllNodes iterates over all nodes and returns them as a slice.

func Count

func Count(it Iterator) int

Count counts the nodes in the iterator. Iterator will be exhausted as a result.

Types

type Empty

type Empty = nodes.Empty

type Interface

type Interface interface {
	// Prepare parses the query and prepares it for repeated execution.
	Prepare(query string) (Query, error)
	// Execute prepares and runs a query for a given subtree.
	Execute(root nodes.External, query string) (Iterator, error)
}

type IterOrder

type IterOrder = nodes.IterOrder

type Iterator

type Iterator = nodes.Iterator

func NewIterator

func NewIterator(root nodes.External, order IterOrder) Iterator

NewIterator creates a new iterator with a given order. It's an extension of nodes.NewIterator that additionally supports PositionOrder.

type Query

type Query interface {
	// Execute runs a query for a given subtree.
	Execute(root nodes.External) (Iterator, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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