kvrocks
kvrocks copied to clipboard
JSON: support basic legacy path
RedisJson supports a JsonPath for legacy client [1]. This patch only support the basic JsonPath "."
Note: this patch doesn't means fully compatible with Json legacy path, it just try it best to convert to JsonPath. There're still some behaviors we cannot compatible with.
[1] https://redis.io/docs/data-types/json/path/#legacy-path-syntax
Actually there are some difference in the query result between path $.x and .x (or x). It can be observe that query of path prefixed without $ will just get response with the first matched value instead of an array.
This patch is only a basic json legacy path support, the detail rule will be handled later.
@PragmaTwice I've add a JsonPath type, however, currently I find the evaluation has a problem when we need support both const and mutable. Would you mind take a look?
Note: this patch doesn't means fully compatible with Json legacy path, it just try it best to convert to JsonPath. There're still some behaviors we cannot compatible with.
I found that:
- Field name like
$ais not support ['a']or["a"]is not so well support now
Close as stale. @mapleFU welcome to pick up and rebase on a new patch.