Use literals in jsonpath examples (#15775)

It's very difficult to figure out e.g. the correct quotes to use from
regular text that is subject to being converted for typographers quotes.
Use code literals instead to ensure that nothing is modified, and to
distinguish literals from accompanying text.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter
2019-08-11 20:53:10 -04:00
committed by Kubernetes Prow Robot
parent 5c41bb0482
commit 8344dda2f6
3 changed files with 38 additions and 38 deletions
+12 -12
View File
@@ -49,15 +49,15 @@ JSONPath 模板由 {} 包起来的 JSONPath 表达式组成。
]
}
```
| 函数 | 描述 | 示例 | 结果 |
| ----------------- | ---------- | ---------------------------------------- | ---------------------------------------- |
| text | 纯文本 | kind is {.kind} | kind is List |
| @ | 当前对象 | {@} | 与输入相同 |
| . or [] | 子运算符 | {.kind} 或者 {['kind']} | List |
| .. | 递归下降 | {..name} | 127.0.0.1 127.0.0.2 myself e2e |
| * | 通配符,获取所有对象 | {.items[*].metadata.name} | [127.0.0.1 127.0.0.2] |
| [start:end :step] | 下标运算符 | {.users[0].name} | myself |
| [,] | 并集运算符 | {.items[*]['metadata.name', 'status.capacity']} | 127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8] |
| ?() | 过滤 | {.users[?(@.name=="e2e")].user.password} | secret |
| range, end | 迭代列表 | {range .items[*]}[{.metadata.name}, {.status.capacity}] {end} | [127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] |
| "" | 引用解释执行字符串 | {range .items[*]}{.metadata.name}{"\t"}{end} | 127.0.0.1 127.0.0.2 |
| 函数 | 描述 | 示例 | 结果 |
| ------------------- | ---------- | ------------------------------------------ | ------------------------------------------ |
| `text` | 纯文本 | `kind is {.kind}` | `kind is List` |
| `@` | 当前对象 | `{@}` | 与输入相同 |
| `.` 或者 `[]` | 子运算符 | `{.kind}` 或者 `{['kind']}` | `List` |
| `..` | 递归下降 | `{..name}` | `127.0.0.1 127.0.0.2 myself e2e` |
| `*` | 通配符,获取所有对象 | `{.items[*].metadata.name}` | `[127.0.0.1 127.0.0.2]` |
| `[start:end :step]` | 下标运算符 | `{.users[0].name}` | `myself` |
| `[,]` | 并集运算符 | `{.items[*]['metadata.name', 'status.capacity']}` | `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]` |
| `?()` | 过滤 | `{.users[?(@.name=="e2e")].user.password}` | `secret` |
| `range`, `end` | 迭代列表 | `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}` | `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]` |
| `''` | 引用解释执行字符串 | `{range .items[*]}{.metadata.name}{'\t'}{end}` | `127.0.0.1 127.0.0.2` |