pathsyntax

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path struct {
	Segments []Segment
	IsRoot   bool // true when path is just "."
}

Path is a parsed jq-like path.

func Parse

func Parse(s string) (Path, error)

Parse parses a jq-like path string into a Path. Returns error for invalid syntax.

func (Path) String

func (p Path) String() string

String returns the canonical string representation of the path.

type Segment

type Segment struct {
	Type  SegmentType
	Field string // for SegmentField
	Index int    // for SegmentIndex
}

Segment is one step in a path.

type SegmentType

type SegmentType int

SegmentType represents the kind of path segment.

const (
	SegmentField SegmentType = iota
	SegmentIndex
)

Jump to

Keyboard shortcuts

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