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.