Skip to content

Commit

Permalink
json/fix-arity-of-json-set
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Oct 21, 2023
1 parent 0bd1f94 commit 6b4b1f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/cmd_json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CommandJsonType : public Commander {
}
};

REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", -3, "write", 1, 1, 1),
REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", 4, "write", 1, 1, 1),
MakeCmdAttr<CommandJsonGet>("json.get", -2, "read-only", 1, 1, 1),
MakeCmdAttr<CommandJsonType>("json.type", -2, "read-only", 1, 1, 1),
MakeCmdAttr<CommandJsonArrAppend>("json.arrappend", -4, "write", 1, 1, 1), );
Expand Down
1 change: 1 addition & 0 deletions tests/gocase/unit/type/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestJson(t *testing.T) {
defer func() { require.NoError(t, rdb.Close()) }()

t.Run("JSON.SET and JSON.GET basics", func(t *testing.T) {
require.Error(t, rdb.Do(ctx, "JSON.SET", "a").Err())
require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", ` {"x":1, "y":2} `).Err())
require.Equal(t, rdb.Do(ctx, "JSON.GET", "a").Val(), `{"x":1,"y":2}`)

Expand Down

0 comments on commit 6b4b1f7

Please sign in to comment.