From 2d3240f31b4e7111e6162476bdffd4c1c3794002 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Sun, 17 Jul 2022 02:40:07 -0400 Subject: [PATCH] Add optional for FCALL and FCALL_RO command json file (#10988) According to the Redis functions documentation, FCALL command format could be FCALL function_name numberOfKeys [key1, key2, key3.....] [arg1, arg2, arg3.....] So in the json file of fcall and fcall_ro, we should add optional for key and arg part. Just like EVAL... Co-authored-by: Binbin --- src/commands.c | 8 ++++---- src/commands/fcall.json | 2 ++ src/commands/fcall_ro.json | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/commands.c b/src/commands.c index 63dfd92e37..07f09bc15b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -3352,8 +3352,8 @@ struct redisCommandArg EVAL_RO_Args[] = { struct redisCommandArg FCALL_Args[] = { {"function",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"numkeys",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_MULTIPLE}, -{"arg",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE}, +{"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE}, +{"arg",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE}, {0} }; @@ -3369,8 +3369,8 @@ struct redisCommandArg FCALL_Args[] = { struct redisCommandArg FCALL_RO_Args[] = { {"function",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE}, {"numkeys",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE}, -{"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_MULTIPLE}, -{"arg",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE}, +{"key",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE}, +{"arg",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE}, {0} }; diff --git a/src/commands/fcall.json b/src/commands/fcall.json index 27b7b4e353..9e7a905ecd 100644 --- a/src/commands/fcall.json +++ b/src/commands/fcall.json @@ -52,11 +52,13 @@ "name": "key", "type": "key", "key_spec_index": 0, + "optional": true, "multiple": true }, { "name": "arg", "type": "string", + "optional": true, "multiple": true } ] diff --git a/src/commands/fcall_ro.json b/src/commands/fcall_ro.json index 46085ebb02..6ba2736c07 100644 --- a/src/commands/fcall_ro.json +++ b/src/commands/fcall_ro.json @@ -51,11 +51,13 @@ "name": "key", "type": "key", "key_spec_index": 0, + "optional": true, "multiple": true }, { "name": "arg", "type": "string", + "optional": true, "multiple": true } ]