Skip to content

Commit

Permalink
Add support for CLUSTER MYSHARDID command (#2530)
Browse files Browse the repository at this point in the history
* feat: add support for CLUSTER MYSHARDID command

Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com>
  • Loading branch information
SoulPancake and SoulPancake committed Apr 17, 2023
1 parent 7b4f217 commit 0d860cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
7 changes: 7 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0d860cb

Please sign in to comment.