Documentation
¶
Index ¶
- Constants
- Variables
- func Entry(yaml string, jsonpath string) string
- type BooleanNode
- type ChildSegment
- type ChildSegmentSubKind
- type ComparisonNode
- type CurrentNode
- type DescendantSegment
- type DescendantSegmentSubKind
- type Expr
- type FunctionCallNode
- type Kind
- type Node
- type NullNode
- type NumberNode
- type Parser
- type Query
- type RootNode
- type Segment
- type Selector
- type SelectorSubKind
- type StringNode
- type Token
- type TokenInfo
- type Tokenizer
- type Tokens
Constants ¶
const ( DescendantWildcardSelector = iota DescendantDotNameSelector DescendantLongSelector )
const ( EdgeItem = "├── " EdgeLast = "└── " )
Variables ¶
var (
ParseError = errors.New("parse error")
)
var SimpleTokens = [...]Token{ STRING_LITERAL, NUMBER, STRING, CHILD, BRACKET_LEFT, BRACKET_RIGHT, ROOT, }
Functions ¶
Types ¶
type BooleanNode ¶
type BooleanNode struct {
Value TokenInfo // boolean value
}
BooleanNode represents a boolean literal in a JSONPath expression.
func (*BooleanNode) End ¶
func (n *BooleanNode) End() TokenInfo
func (*BooleanNode) Pos ¶
func (n *BooleanNode) Pos() TokenInfo
func (*BooleanNode) String ¶
func (n *BooleanNode) String() string
type ChildSegment ¶
type ChildSegment struct {
SubKind ChildSegmentSubKind
Tokens []TokenInfo
InnerSelector *Selector
}
child-segment = bracketed-selection /
("."
(wildcard-selector /
member-name-shorthand))
func (ChildSegment) Kind ¶
func (c ChildSegment) Kind() Kind
type ChildSegmentSubKind ¶
type ChildSegmentSubKind int
const ( ChildSegmentDotWildcard ChildSegmentSubKind = iota ChildSegmentDotMemberName ChildSegmentSelector )
type ComparisonNode ¶
type ComparisonNode struct {
Lhs Expr // left-hand side expression
Operator TokenInfo // comparison operator
Rhs Expr // right-hand side expression
}
ComparisonNode represents a comparison expression in a JSONPath filter.
type CurrentNode ¶
type CurrentNode struct {
At TokenInfo // position of "@"
}
CurrentNode represents the current node in a JSONPath expression.
func (*CurrentNode) String ¶
func (n *CurrentNode) String() string
type DescendantSegment ¶
type DescendantSegment struct {
SubKind DescendantSegmentSubKind
LongFormInner Segment
}
func (DescendantSegment) Kind ¶
func (d DescendantSegment) Kind() Kind
type DescendantSegmentSubKind ¶
type DescendantSegmentSubKind int
type Expr ¶
type Expr interface {
Node
// contains filtered or unexported methods
}
Expr represents a JSONPath expression.
type FunctionCallNode ¶
type FunctionCallNode struct {
Name TokenInfo // function name
Lparen TokenInfo // position of "("
Args []Expr // function arguments
Rparen TokenInfo // position of ")"
}
FunctionCallNode represents a function call in a JSONPath expression.
func (*FunctionCallNode) End ¶
func (n *FunctionCallNode) End() TokenInfo
func (*FunctionCallNode) Pos ¶
func (n *FunctionCallNode) Pos() TokenInfo
type Node ¶
type Node interface {
Kind() Kind // The Kind of the node
}
Node represents a node in the JSONPath AST.
type NullNode ¶
type NullNode struct {
Null TokenInfo // position of "null"
}
NullNode represents a null literal in a JSONPath expression.
type NumberNode ¶
type NumberNode struct {
Value TokenInfo // numeric value
}
NumberNode represents a numeric literal in a JSONPath expression.
func (*NumberNode) End ¶
func (n *NumberNode) End() TokenInfo
func (*NumberNode) Pos ¶
func (n *NumberNode) Pos() TokenInfo
func (*NumberNode) String ¶
func (n *NumberNode) String() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a JSONPath parser.
type Query ¶
JSONPath expression built from segments that have been syntactically restricted in a certain way (Section 2.3.5.1)
type RootNode ¶
type RootNode struct {
Dollar TokenInfo // position of "$"
}
RootNode represents the root node of a JSONPath expression.
type Selector ¶
type Selector struct {
SubKind SelectorSubKind
}
type SelectorSubKind ¶
type SelectorSubKind int
const ( SelectorSubKindWildcard SelectorSubKind = iota SelectorSubKindName SelectorSubKindArraySlice SelectorSubKindArrayIndex SelectorSubKindFilter )
type StringNode ¶
type StringNode struct {
Value TokenInfo // string value
}
StringNode represents a string literal in a JSONPath expression.
func (*StringNode) End ¶
func (n *StringNode) End() TokenInfo
func (*StringNode) Pos ¶
func (n *StringNode) Pos() TokenInfo
func (*StringNode) String ¶
func (n *StringNode) String() string
type Token ¶
type Token int
Token represents a lexical token in a JSONPath expression.
type Tokenizer ¶
type Tokenizer struct {
// contains filtered or unexported fields
}
Tokenizer represents a JSONPath tokenizer.
func NewTokenizer ¶
NewTokenizer creates a new JSONPath tokenizer for the given input string.
func (Tokenizer) ErrorString ¶
When there's an error in the tokenizer, this helps represent it.
func (Tokenizer) ErrorTokenString ¶
When there's an error