From 0d860cb03824e6a00acf801b1187905a7540000a Mon Sep 17 00:00:00 2001 From: Anurag Bandyopadhyay Date: Mon, 17 Apr 2023 19:22:35 +0530 Subject: [PATCH] Add support for CLUSTER MYSHARDID command (#2530) * feat: add support for CLUSTER MYSHARDID command Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> --- cluster_test.go | 6 ++++++ commands.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/cluster_test.go b/cluster_test.go index 92471647..be249424 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 588b3a4f..c9b2af29 100644 --- a/commands.go +++ b/commands.go @@ -460,6 +460,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 @@ -3584,6 +3585,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)