Skip to content

Commit b507796

Browse files
ofekshenawavladvildanov
authored andcommitted
Support Json with Resp 2 (redis#3146)
* Support ReJSON resp 2 && Test ReJSON against RESP 2 and 3 && Add complex search and json test * Remove comments * Remove unnecessary changes
1 parent d9eeed1 commit b507796

File tree

2 files changed

+785
-627
lines changed

2 files changed

+785
-627
lines changed

json.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type JSONArrTrimArgs struct {
6060
type JSONCmd struct {
6161
baseCmd
6262
val string
63-
expanded []interface{}
63+
expanded interface{}
6464
}
6565

6666
var _ Cmder = (*JSONCmd)(nil)
@@ -100,11 +100,11 @@ func (cmd *JSONCmd) Result() (string, error) {
100100
return cmd.Val(), cmd.Err()
101101
}
102102

103-
func (cmd JSONCmd) Expanded() (interface{}, error) {
103+
func (cmd *JSONCmd) Expanded() (interface{}, error) {
104104
if len(cmd.val) != 0 && cmd.expanded == nil {
105105
err := json.Unmarshal([]byte(cmd.val), &cmd.expanded)
106106
if err != nil {
107-
return "", err
107+
return nil, err
108108
}
109109
}
110110

@@ -494,7 +494,7 @@ func (c cmdable) JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd
494494
}
495495

496496
// JSONNumIncrBy increments the number value stored at the specified path by the provided number.
497-
// For more information, see https://redis.io/commands/json.numincreby
497+
// For more information, see https://redis.io/docs/latest/commands/json.numincrby/
498498
func (c cmdable) JSONNumIncrBy(ctx context.Context, key, path string, value float64) *JSONCmd {
499499
args := []interface{}{"JSON.NUMINCRBY", key, path, value}
500500
cmd := newJSONCmd(ctx, args...)

0 commit comments

Comments
 (0)