pottery icon indicating copy to clipboard operation
pottery copied to clipboard

Support for Redis JSON

Open devleaks opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

There is room for a RedisJSON "proxy object" that would stay in sync with its Redis JSON value.

Describe the solution you'd like

>>> obj = RedisJSON({"a": 1}, redis=redis, key="json_document")
>>> obj["b"] = {"c": [2]}
>>> print(redis.json().get("json_document")
{"a": 1, "b": {"c": [2]}}
>>> redis.json().arrappend("json_document", Path("b.c"), 3)
>>> print(obj["b"]["c"])
[2, 3]

(May be we could even limit assignments to JSON/JavaScript-valid only types like string, int, float, boolean, null.)

Describe alternatives you've considered RedisDict{}

Additional context Not applicable.

devleaks avatar May 24 '22 12:05 devleaks