walk

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 8 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

func SetAtLocation added in v1.6.0

func SetAtLocation[T any](parent any, l LocationContext[T], value any) error

Types

type LocationContext

type LocationContext[T any] struct {
	ParentMatchFunc 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