Skip to content

Commit 82b00cc

Browse files
cxljsndyakov
andauthored
chore: remove a redundant method (#3401)
Signed-off-by: fukua95 <[email protected]> Co-authored-by: Nedyalko Dyakov <[email protected]>
1 parent e2295c7 commit 82b00cc

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

osscluster.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -979,13 +979,6 @@ func (c *ClusterClient) Close() error {
979979
return c.nodes.Close()
980980
}
981981

982-
// Do create a Cmd from the args and processes the cmd.
983-
func (c *ClusterClient) Do(ctx context.Context, args ...interface{}) *Cmd {
984-
cmd := NewCmd(ctx, args...)
985-
_ = c.Process(ctx, cmd)
986-
return cmd
987-
}
988-
989982
func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error {
990983
err := c.processHook(ctx, cmd)
991984
cmd.SetErr(err)

osscluster_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ var _ = Describe("ClusterClient", func() {
264264
var client *redis.ClusterClient
265265

266266
assertClusterClient := func() {
267+
It("do", func() {
268+
val, err := client.Do(ctx, "ping").Result()
269+
Expect(err).NotTo(HaveOccurred())
270+
Expect(val).To(Equal("PONG"))
271+
})
272+
267273
It("should GET/SET/DEL", func() {
268274
err := client.Get(ctx, "A").Err()
269275
Expect(err).To(Equal(redis.Nil))

redis.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,13 +776,6 @@ func (c *Client) Conn() *Conn {
776776
return newConn(c.opt, pool.NewStickyConnPool(c.connPool), &c.hooksMixin)
777777
}
778778

779-
// Do create a Cmd from the args and processes the cmd.
780-
func (c *Client) Do(ctx context.Context, args ...interface{}) *Cmd {
781-
cmd := NewCmd(ctx, args...)
782-
_ = c.Process(ctx, cmd)
783-
return cmd
784-
}
785-
786779
func (c *Client) Process(ctx context.Context, cmd Cmder) error {
787780
err := c.processHook(ctx, cmd)
788781
cmd.SetErr(err)

redis_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ var _ = Describe("Client", func() {
8989
Expect(err).NotTo(HaveOccurred())
9090
})
9191

92+
It("do", func() {
93+
val, err := client.Do(ctx, "ping").Result()
94+
Expect(err).NotTo(HaveOccurred())
95+
Expect(val).To(Equal("PONG"))
96+
})
97+
9298
It("should ping", func() {
9399
val, err := client.Ping(ctx).Result()
94100
Expect(err).NotTo(HaveOccurred())

ring.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,6 @@ func (c *Ring) SetAddrs(addrs map[string]string) {
563563
c.sharding.SetAddrs(addrs)
564564
}
565565

566-
// Do create a Cmd from the args and processes the cmd.
567-
func (c *Ring) Do(ctx context.Context, args ...interface{}) *Cmd {
568-
cmd := NewCmd(ctx, args...)
569-
_ = c.Process(ctx, cmd)
570-
return cmd
571-
}
572-
573566
func (c *Ring) Process(ctx context.Context, cmd Cmder) error {
574567
err := c.processHook(ctx, cmd)
575568
cmd.SetErr(err)

ring_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ var _ = Describe("Redis Ring", func() {
7474
Expect(ring.Close()).NotTo(HaveOccurred())
7575
})
7676

77+
It("do", func() {
78+
val, err := ring.Do(ctx, "ping").Result()
79+
Expect(err).NotTo(HaveOccurred())
80+
Expect(val).To(Equal("PONG"))
81+
})
82+
7783
It("supports context", func() {
7884
ctx, cancel := context.WithCancel(ctx)
7985
cancel()

0 commit comments

Comments
 (0)