From f237d301598f9f14df21d8bba6ea8521034e4c3f Mon Sep 17 00:00:00 2001 From: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Date: Mon, 3 Apr 2023 13:03:13 +0530 Subject: [PATCH 1/3] feat: add support for CLUSTER MYSHARDID command --- cluster_test.go | 6 ++++++ commands.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/cluster_test.go b/cluster_test.go index 924716476..be2494241 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -746,6 +746,12 @@ var _ = Describe("ClusterClient", func() { }) }) + It("should CLUSTER MYSHARDID", func() { + shardID, err := client.ClusterMyShardID(ctx).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(shardID).ToNot(BeEmpty()) + }) + It("should CLUSTER NODES", func() { res, err := client.ClusterNodes(ctx).Result() Expect(err).NotTo(HaveOccurred()) diff --git a/commands.go b/commands.go index 4aa0c882c..53ad6e299 100644 --- a/commands.go +++ b/commands.go @@ -425,6 +425,7 @@ type Cmdable interface { PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd + ClusterMyShardID(ctx context.Context) *StringCmd ClusterSlots(ctx context.Context) *ClusterSlotsCmd ClusterShards(ctx context.Context) *ClusterShardsCmd ClusterLinks(ctx context.Context) *ClusterLinksCmd @@ -3549,6 +3550,12 @@ func (c cmdable) PubSubNumPat(ctx context.Context) *IntCmd { //------------------------------------------------------------------------------ +func (c cmdable) ClusterMyShardID(ctx context.Context) *StringCmd { + cmd := NewStringCmd(ctx, "cluster", "myshardid") + _ = c(ctx, cmd) + return cmd +} + func (c cmdable) ClusterSlots(ctx context.Context) *ClusterSlotsCmd { cmd := NewClusterSlotsCmd(ctx, "cluster", "slots") _ = c(ctx, cmd) From e4299fee6495cffb048bee2f2a45937b947d92cc Mon Sep 17 00:00:00 2001 From: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:32:54 +0530 Subject: [PATCH 2/3] comm --- cluster_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster_test.go b/cluster_test.go index be2494241..1e4a54fad 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -749,7 +749,7 @@ var _ = Describe("ClusterClient", func() { It("should CLUSTER MYSHARDID", func() { shardID, err := client.ClusterMyShardID(ctx).Result() Expect(err).NotTo(HaveOccurred()) - Expect(shardID).ToNot(BeEmpty()) + Expect(shardID).ToNot(BeEmpty()) // Only meaningful test currently }) It("should CLUSTER NODES", func() { From fa52a567c7a019d6c6c4530913e243d5dc8a91a7 Mon Sep 17 00:00:00 2001 From: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:33:38 +0530 Subject: [PATCH 3/3] lassan --- cluster_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster_test.go b/cluster_test.go index 1e4a54fad..be2494241 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -749,7 +749,7 @@ var _ = Describe("ClusterClient", func() { It("should CLUSTER MYSHARDID", func() { shardID, err := client.ClusterMyShardID(ctx).Result() Expect(err).NotTo(HaveOccurred()) - Expect(shardID).ToNot(BeEmpty()) // Only meaningful test currently + Expect(shardID).ToNot(BeEmpty()) }) It("should CLUSTER NODES", func() {