Documentation
¶
Overview ¶
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/. In addition, it has {range} {end} function to iterate list and slice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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", }
Functions ¶
This section is empty.
Types ¶
type ArrayNode ¶
type ArrayNode struct { NodeType Params [3]ParamsEntry //start, end, step }
ArrayNode holds start, end, step information for array index selection
type FieldNode ¶
FieldNode holds filed of struct
type FilterNode ¶
FilterNode holds operand and operator information for filter
func (*FilterNode) String ¶
func (f *FilterNode) String() string
type FloatNode ¶
FloatNode holds float value
type IdentifierNode ¶
IdentifierNode holds an identifier
func (*IdentifierNode) String ¶
func (f *IdentifierNode) String() string
type IntNode ¶
IntNode holds integer value
type JSONPath ¶
type JSONPath struct {
// contains filtered or unexported fields
}
func (*JSONPath) Execute ¶
Execute bounds data into template and write the result
func (*JSONPath) FindResults ¶
func (*JSONPath) Parse ¶
Parse parse the given template, return error
type ListNode ¶
ListNode holds a sequence of nodes.
type ParamsEntry ¶
ParamsEntry holds param information for ArrayNode
type Parser ¶
func Parse ¶
Parse parsed the given text and return a node Parser. If an error is encountered, parsing stops and an empty Parser is returned with the error
type RecursiveNode ¶
type RecursiveNode struct {
NodeType
}
RecursiveNode means a recursive descent operator
func (*RecursiveNode) String ¶
func (r *RecursiveNode) String() string
type TextNode ¶
TextNode holds plain text.
type UnionNode ¶
UnionNode is union of ListNode
type WildcardNode ¶
type WildcardNode struct {
NodeType
}
WildcardNode means a wildcard
func (*WildcardNode) String ¶
func (i *WildcardNode) String() string