Support ReJSON resp 2 && Test ReJSON against RESP 2 and 3 && Add complex search and json test

This commit is contained in:
ofekshenawa 2024-10-08 00:36:40 +03:00
parent 9e3709c404
commit 56bcaaa351
3 changed files with 774 additions and 615 deletions

3
go.mod
View File

@ -7,9 +7,10 @@ require (
github.com/bsm/gomega v1.27.10 github.com/bsm/gomega v1.27.10
github.com/cespare/xxhash/v2 v2.2.0 github.com/cespare/xxhash/v2 v2.2.0
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
github.com/go-redis/redis/v8 v8.11.5
) )
retract ( retract (
v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead.
v9.5.4 // This version was accidentally released. Please use version 9.6.0 instead. v9.5.4 // This version was accidentally released. Please use version 9.6.0 instead.
v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead.
) )

View File

@ -60,7 +60,7 @@ type JSONArrTrimArgs struct {
type JSONCmd struct { type JSONCmd struct {
baseCmd baseCmd
val string val string
expanded []interface{} expanded interface{}
} }
var _ Cmder = (*JSONCmd)(nil) var _ Cmder = (*JSONCmd)(nil)
@ -100,11 +100,11 @@ func (cmd *JSONCmd) Result() (string, error) {
return cmd.Val(), cmd.Err() return cmd.Val(), cmd.Err()
} }
func (cmd JSONCmd) Expanded() (interface{}, error) { func (cmd *JSONCmd) Expanded() (interface{}, error) {
if len(cmd.val) != 0 && cmd.expanded == nil { if len(cmd.val) != 0 && cmd.expanded == nil {
err := json.Unmarshal([]byte(cmd.val), &cmd.expanded) err := json.Unmarshal([]byte(cmd.val), &cmd.expanded)
if err != nil { if err != nil {
return "", err return nil, err
} }
} }
@ -494,7 +494,7 @@ func (c cmdable) JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd
} }
// JSONNumIncrBy increments the number value stored at the specified path by the provided number. // JSONNumIncrBy increments the number value stored at the specified path by the provided number.
// For more information, see https://redis.io/commands/json.numincreby // For more information, see https://redis.io/docs/latest/commands/json.numincrby/
func (c cmdable) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd { func (c cmdable) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd {
args := []interface{}{"JSON.NUMINCRBY", key, path, value} args := []interface{}{"JSON.NUMINCRBY", key, path, value}
cmd := newJSONCmd(ctx, args...) cmd := newJSONCmd(ctx, args...)

File diff suppressed because it is too large Load Diff