Skip to content

Commit

Permalink
Support Json with Resp 2 (#3146) (#3155)
Browse files Browse the repository at this point in the history
* Support ReJSON resp 2 && Test ReJSON against RESP 2 and 3 && Add complex search and json test

* Remove comments

* Remove unnecessary changes

Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
  • Loading branch information
vladvildanov and ofekshenawa authored Oct 14, 2024
1 parent ec680ae commit ac2e91d
Show file tree
Hide file tree
Showing 2 changed files with 785 additions and 627 deletions.
8 changes: 4 additions & 4 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type JSONArrTrimArgs struct {
type JSONCmd struct {
baseCmd
val string
expanded []interface{}
expanded interface{}
}

var _ Cmder = (*JSONCmd)(nil)
Expand Down Expand Up @@ -100,11 +100,11 @@ func (cmd *JSONCmd) Result() (string, error) {
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 {
err := json.Unmarshal([]byte(cmd.val), &cmd.expanded)
if err != nil {
return "", err
return nil, err
}
}

Expand Down Expand Up @@ -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.
// 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 {
args := []interface{}{"JSON.NUMINCRBY", key, path, value}
cmd := newJSONCmd(ctx, args...)
Expand Down
Loading

0 comments on commit ac2e91d

Please sign in to comment.