Skip to content

Commit 0d860cb

Browse files
authored
Add support for CLUSTER MYSHARDID command (#2530)
* feat: add support for CLUSTER MYSHARDID command Co-authored-by: Anuragkillswitch <[email protected]>
1 parent 7b4f217 commit 0d860cb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cluster_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,12 @@ var _ = Describe("ClusterClient", func() {
746746
})
747747
})
748748

749+
It("should CLUSTER MYSHARDID", func() {
750+
shardID, err := client.ClusterMyShardID(ctx).Result()
751+
Expect(err).NotTo(HaveOccurred())
752+
Expect(shardID).ToNot(BeEmpty())
753+
})
754+
749755
It("should CLUSTER NODES", func() {
750756
res, err := client.ClusterNodes(ctx).Result()
751757
Expect(err).NotTo(HaveOccurred())

commands.go

+7
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ type Cmdable interface {
460460
PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd
461461
PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd
462462

463+
ClusterMyShardID(ctx context.Context) *StringCmd
463464
ClusterSlots(ctx context.Context) *ClusterSlotsCmd
464465
ClusterShards(ctx context.Context) *ClusterShardsCmd
465466
ClusterLinks(ctx context.Context) *ClusterLinksCmd
@@ -3584,6 +3585,12 @@ func (c cmdable) PubSubNumPat(ctx context.Context) *IntCmd {
35843585

35853586
//------------------------------------------------------------------------------
35863587

3588+
func (c cmdable) ClusterMyShardID(ctx context.Context) *StringCmd {
3589+
cmd := NewStringCmd(ctx, "cluster", "myshardid")
3590+
_ = c(ctx, cmd)
3591+
return cmd
3592+
}
3593+
35873594
func (c cmdable) ClusterSlots(ctx context.Context) *ClusterSlotsCmd {
35883595
cmd := NewClusterSlotsCmd(ctx, "cluster", "slots")
35893596
_ = c(ctx, cmd)

0 commit comments

Comments
 (0)