jsonpath user guide docs
This commit is contained in:
@@ -118,7 +118,7 @@ func TestStructInput(t *testing.T) {
|
||||
{"union", "{[1,3,4]}", []int{0, 1, 2, 3, 4}, "1 3 4"},
|
||||
{"array", "{[0:2]}", []string{"Monday", "Tudesday"}, "Monday Tudesday"},
|
||||
{"variable", "hello {.Name}", storeData, "hello jsonpath"},
|
||||
{"dict/", "{.Labels.web/html}", storeData, "15"},
|
||||
{"dict/", "{$.Labels.web/html}", storeData, "15"},
|
||||
{"dict-", "{.Labels.k8s-app}", storeData, "20"},
|
||||
{"nest", "{.Bicycle.Color}", storeData, "red"},
|
||||
{"allarray", "{.Book[*].Author}", storeData, "Nigel Rees Evelyn Waugh Herman Melville"},
|
||||
@@ -210,6 +210,7 @@ func TestKubenates(t *testing.T) {
|
||||
`127.0.0.1 127.0.0.2 127.0.0.3`},
|
||||
{"double range", "{range .items[*]}{range .status.addresses[*]}{.address}, {end}{end}", nodesData,
|
||||
`127.0.0.1, 127.0.0.2, 127.0.0.3, `},
|
||||
{"recursive name", "{..name}", nodesData, `127.0.0.1 127.0.0.2 myself e2e`},
|
||||
{"item name", "{.items[*].metadata.name}", nodesData, `127.0.0.1 127.0.0.2`},
|
||||
{"union nodes capacity", "{.items[*]['metadata.name', 'status.capacity']}", nodesData,
|
||||
`127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]`},
|
||||
|
@@ -151,7 +151,7 @@ func (p *Parser) parseInsideAction(cur *ListNode) error {
|
||||
return fmt.Errorf("unclosed action")
|
||||
case r == ' ':
|
||||
p.consumeText()
|
||||
case r == '@': //the current object, just pass it
|
||||
case r == '@' || r == '$': //the current object, just pass it
|
||||
p.consumeText()
|
||||
case r == '[':
|
||||
return p.parseArray(cur)
|
||||
|
Reference in New Issue
Block a user