Issues with Go

Hi,

I’m trying to use the RedisJSON2 new functionalities with Go, but the go-rejson still don’t have them. I tried to do the functions manually and they work in parts.

I can get the data with queries, I can insert, but when the data is inserted via Go, the fields are not being able to be filtered.

Any ideias how can I fix it, or if there is another repo where I can get these funcions.

Here is the repo I forked and with the new functions:

https://github.com/gatomazi/go-rejson/tree/jsonQGET

Hi Gabriel,

Thank you very much for the effort to extend the go-rejson client!

Can you please add an example code? How to run and recreate the issue with the new go client?

Guy

Just do a simple (in my case) goredis connection

rh := rejson.NewReJSONHandler()

conn := rh.SetGoRedisClient(goredis.NewClient(&goredis.Options{Addr: HostRedis}))

``

Inserting and index

_, err = conn.JSONIndexAdd(“users”, “last”, “.last”)

``

And inserting the json

_, err = conn.JSONSetWithIndex(“user1”, “.”, document, “users”)

``

Where de var document is a map[string]interface{} with data.

The function JSONSetWithIndex, do the same Marshal as JSONSet, so the map turn in a json.

Then a JSONQGet i`m using:

test, _ := conn.JSONQGet(“users”, “@last:Smith”, “@first:Joe”)

``

Just pass the params as in the string of query.

The weird is that the data is stored in Redis as JSON, but the are not find by the index. If I add the JSON.SET command line direct in cli, the function o QGET works fine.

I think that the marshal may be the problem, the output of the command:

The document is in an byte.

I tried without marshal too, putting the same command line string on a Do function of redis. It inserts in Redis, but the fields are not filtered.

PS: Yes, i’m adding the fields to the index