walk

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrTerminate is a sentinel error that can be returned from a MatchFunc to detect when to terminate the walk.
	// When used with the iterator API, users can check for this error and break out of the for loop.
	ErrTerminate = errors.Error("terminate")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LocationContext

type LocationContext[T any] struct {
	Parent      T
	ParentField string
	ParentKey   *string
	ParentIndex *int
}

LocationContext represents the context of where an element is located within its parent. It uses generics to work with different MatchFunc types from different packages.

type Locations

type Locations[T any] []LocationContext[T]

Locations represents a slice of location contexts that can be converted to a JSON pointer.

func (Locations[T]) ToJSONPointer

func (l Locations[T]) ToJSONPointer() jsonpointer.JSONPointer

ToJSONPointer converts the locations to a JSON pointer.

Jump to

Keyboard shortcuts

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