query

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

query handles finding a match in a tree, but not unmarshaling the node. This package should not generally be used directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryAll added in v0.0.1

func QueryAll(doc ast.Node, source []byte, query []match.Node, extractor match.Node) (found []ast.Node, err error)

Use all but the last matcher in the query to find a parent node, then return a list of descendants that match the last matcher.

func QueryOne added in v0.0.2

func QueryOne(doc ast.Node, source []byte, query []match.Node) (found ast.Node, err error)

Apply a matcher to a tree, and return the matching node for unmarshaling.

Types

type QueryError

type QueryError struct {
	Matches     []match.Node
	FailedMatch match.Node
}

Error returned when a query fails to match. Includes the list of matches that were found, and the match that failed. Prints an error message that can be used to debug the query.

func (*QueryError) Error

func (e *QueryError) Error() string

Jump to

Keyboard shortcuts

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