From d5d2afa07f4365a8241923dcd2a0944c520c99c9 Mon Sep 17 00:00:00 2001 From: liyaojie Date: Thu, 24 Aug 2023 20:04:03 +0800 Subject: [PATCH] =?UTF-8?q?add=20the=20custom=20commands=20of=20TairString?= =?UTF-8?q?=E3=80=81TairHash=20and=20TairZset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyaojie --- internal/commands/table.go | 76 ++++++++++++++++++++++++++++++------ scripts/commands/exhset.json | 29 ++++++++++++++ scripts/commands/exset.json | 29 ++++++++++++++ scripts/commands/exzadd.json | 29 ++++++++++++++ 4 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 scripts/commands/exhset.json create mode 100644 scripts/commands/exset.json create mode 100644 scripts/commands/exzadd.json diff --git a/internal/commands/table.go b/internal/commands/table.go index 686e9ade..8457f102 100644 --- a/internal/commands/table.go +++ b/internal/commands/table.go @@ -1,22 +1,22 @@ package commands var containers = map[string]bool{ - "XINFO": true, - "COMMAND": true, - "FUNCTION": true, - "CONFIG": true, "MODULE": true, - "MEMORY": true, - "LATENCY": true, - "SCRIPT": true, - "ACL": true, "CLUSTER": true, - "CLIENT": true, "XGROUP": true, - "PUBSUB": true, + "COMMAND": true, + "SLOWLOG": true, "OBJECT": true, + "MEMORY": true, + "CONFIG": true, + "FUNCTION": true, + "LATENCY": true, + "XINFO": true, + "CLIENT": true, "SENTINEL": true, - "SLOWLOG": true, + "PUBSUB": true, + "SCRIPT": true, + "ACL": true, } var redisCommands = map[string]redisCommand{ "LLEN": { @@ -4505,4 +4505,58 @@ var redisCommands = map[string]redisCommand{ }, }, }, + "EXHSET": { + "TAIRHASH", + []keySpec{ + { + "index", + 1, + "", + 0, + "range", + 0, + 1, + 0, + 0, + 0, + 0, + }, + }, + }, + "EXSET": { + "TAIRSTRING", + []keySpec{ + { + "index", + 1, + "", + 0, + "range", + 0, + 1, + 0, + 0, + 0, + 0, + }, + }, + }, + "EXZADD": { + "TAIRZSET", + []keySpec{ + { + "index", + 1, + "", + 0, + "range", + 0, + 1, + 0, + 0, + 0, + 0, + }, + }, + }, } diff --git a/scripts/commands/exhset.json b/scripts/commands/exhset.json new file mode 100644 index 00000000..425110c0 --- /dev/null +++ b/scripts/commands/exhset.json @@ -0,0 +1,29 @@ +{ + "EXHSET": { + "summary": "TairHash, Insert a field into the TairHash specified by the key", + "complexity": "O(1)", + "group": "TairHash", + "container": "TairHash", + "function": "exhsetCommand", + "key_specs": [ + { + "flags": [ + "RW", + "UPDATE" + ], + "begin_search": { + "index": { + "pos": 1 + } + }, + "find_keys": { + "range": { + "lastkey": 0, + "step": 1, + "limit": 0 + } + } + } + ] + } +} diff --git a/scripts/commands/exset.json b/scripts/commands/exset.json new file mode 100644 index 00000000..322b93a1 --- /dev/null +++ b/scripts/commands/exset.json @@ -0,0 +1,29 @@ +{ + "EXSET": { + "summary": "TairString, Set the value of a key", + "complexity": "O(1)", + "group": "TairString", + "container": "TairString", + "function": "exsetCommand", + "key_specs": [ + { + "flags": [ + "RW", + "UPDATE" + ], + "begin_search": { + "index": { + "pos": 1 + } + }, + "find_keys": { + "range": { + "lastkey": 0, + "step": 1, + "limit": 0 + } + } + } + ] + } +} diff --git a/scripts/commands/exzadd.json b/scripts/commands/exzadd.json new file mode 100644 index 00000000..c00ebc74 --- /dev/null +++ b/scripts/commands/exzadd.json @@ -0,0 +1,29 @@ +{ + "EXZADD": { + "summary": "TairZset, Adds all the specified members with the specified (multi)scores to the tairzset stored at key", + "complexity": "O(N)", + "group": "TairZset", + "container": "TairZset", + "function": "exzaddCommand", + "key_specs": [ + { + "flags": [ + "RW", + "UPDATE" + ], + "begin_search": { + "index": { + "pos": 1 + } + }, + "find_keys": { + "range": { + "lastkey": 0, + "step": 1, + "limit": 0 + } + } + } + ] + } +}