redigo
redigo copied to clipboard
Support for RedisJSON
https://oss.redislabs.com/redisjson/ Redis JSON is developed at RedisLabs to give a native JSON datatype to save complex objects in Redis. We can do some operations like INCR on the individual members of a complex struct (for example increment only age in a Person object).
I came across this RedisJSON via an excellent blog post https://itnext.io/storing-go-structs-in-redis-using-rejson-dab7f8fc0053
However, I am a bit uncomfortable using a library other than redigo for my golang programs to talk with redis.
Are there any plans to support the RedisJSON via redigo ? If so, is there any ongoing work that is happening for it and any rough idea on when this might land in redigo ? Thanks.
Hello @psankar
AFAIK redigo doesn't need any additional effort to work with RedisJSON as redigo isn't strongly typed - just conn.Do("json.set"...) to call the module's SET command and so forth.
Hello @itamarhaber , yes I can do conn.Do("json.set"...) but I was looking for a better way to automatically (un)marshal golang structs from/to json while working with redis.
Hello @itamarhaber , yes I can do conn.Do("json.set"...) but I was looking for a better way to automatically (un)marshal golang structs from/to json while working with redis.
Why not use ScanStruct ?
There is some scenario which are difficult to do with marshelling/flat JSON like updating the one Individual key of JSON Object is there any way we can do this without first get the struct and then set the field (means 2 Network RTT)
@2dev2 do you mean like this command? https://redis.io/commands/json.set/
I believe this is answered above (just updated the URL). If that's not the case please feel free to reply and we can re-open.