Documentation
¶
Overview ¶
Package jsonpath provides utilities for working with JSONPath RFC-9535, which is primarily used in govy for constructing property names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeSegment ¶
EscapeSegment accepts a path segment (not the entire path!) and escapes any special characters. Examples:
EscapeSegment("foo") --> "foo"
EscapeSegment("'foo'") --> "['\'foo\'']"
EscapeSegment("foo.bar") --> "['foo.bar']"
func Join ¶
Join extends the JSONPath with a new segment. The segment can be a path in of itself, the segment is assumed to be escaped with EscapeSegment. Example:
Join("foo.bar", "baz") --> "foo.bar.baz"
Join("foo.bar", "baz.foo") --> "foo.bar.baz.foo"
func JoinArray ¶
JoinArray extends the JSONPath with a new array segment. Example:
JoinArray("foo.bar", "[2]") --> "foo.bar[2]"
func NewArrayIndex ¶
NewArrayIndex creates a new array index path segment for the given index. Example:
NewArrayIndex(2) --> "[2]"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.