JSON / MessagePack conversion and secondary-index value extraction. Strip the leading `$.` or `$` prefix from a JSON path expression.
(path: &str)
| 4 | |
| 5 | /// Strip the leading `$.` or `$` prefix from a JSON path expression. |
| 6 | pub(crate) fn normalize_path(path: &str) -> &str { |
| 7 | path.strip_prefix("$.") |
| 8 | .or_else(|| path.strip_prefix('$')) |
| 9 | .unwrap_or(path) |
| 10 | } |
| 11 | |
| 12 | /// Extract scalar values at a JSON path for secondary indexing. |
| 13 | pub fn extract_index_values(doc: &serde_json::Value, path: &str, is_array: bool) -> Vec<String> { |
no outgoing calls
no test coverage detected