Documentation
¶
Index ¶
- Variables
- func PrettyCtyPath(path cty.Path) string
- func UnquoteExtend(s string) (string, error)
- type ArrayNode
- type BoolNode
- type FieldNode
- type FilterNode
- type FloatNode
- type IdentifierNode
- type IntNode
- type JSONPath
- type ListNode
- type Node
- type NodeType
- type ParamsEntry
- type Parser
- type RecursiveNode
- type SearchResult
- type TextNode
- type UnionNode
- type WildcardNode
Constants ¶
This section is empty.
Variables ¶
var (
ErrSyntax = errors.New("invalid syntax")
)
var NodeTypeName = map[NodeType]string{ NodeText: "NodeText", NodeArray: "NodeArray", NodeList: "NodeList", NodeField: "NodeField", NodeIdentifier: "NodeIdentifier", NodeFilter: "NodeFilter", NodeInt: "NodeInt", NodeFloat: "NodeFloat", NodeWildcard: "NodeWildcard", NodeRecursive: "NodeRecursive", NodeUnion: "NodeUnion", NodeBool: "NodeBool", }
Functions ¶
func PrettyCtyPath ¶
Pretty prints a cty.Path into a string
Example:
PrettyCtyPath(c.IndexInt(3)) == ".[3]"
func UnquoteExtend ¶
UnquoteExtend is almost same as strconv.Unquote(), but it support parse single quotes as a string
Types ¶
type ArrayNode ¶
type ArrayNode struct { NodeType Params [3]ParamsEntry // start, end, step }
ArrayNode holds start, end, step information for array index selection
type FilterNode ¶
FilterNode holds operand and operator information for filter
func (*FilterNode) String ¶
func (f *FilterNode) String() string
type IdentifierNode ¶
IdentifierNode holds an identifier
func (*IdentifierNode) String ¶
func (f *IdentifierNode) String() string
type JSONPath ¶
type JSONPath struct {
// contains filtered or unexported fields
}
func (*JSONPath) EnableJSONOutput ¶
EnableJSONOutput changes the PrintResults behavior to return a JSON array of results
func (*JSONPath) Search ¶
func (j *JSONPath) Search(data cty.Value) SearchResult
Given a JSON Path, this lets you search a cty.Value and return a result struct containg Value/Path pairs. There may not be 1:1 mapping between both (due to recursive calls).
Instead, it's better to iterate the paths and call .Apply(value) on them.
type ParamsEntry ¶
type ParamsEntry struct { Value int Known bool // whether the value is known when parse it Derived bool }
ParamsEntry holds param information for ArrayNode
type Parser ¶
type Parser struct { Root *ListNode // contains filtered or unexported fields }
type RecursiveNode ¶
type RecursiveNode struct {
NodeType
}
RecursiveNode means a recursive descent operator
func (*RecursiveNode) String ¶
func (r *RecursiveNode) String() string
type SearchResult ¶
type SearchResult struct { Values []cty.Value Paths []cty.Path // contains filtered or unexported fields }
func (SearchResult) String ¶
func (s SearchResult) String() (out string)
type WildcardNode ¶
type WildcardNode struct {
NodeType
}
WildcardNode means a wildcard
func (*WildcardNode) String ¶
func (i *WildcardNode) String() string