Skip to content

Commit 7d94a71

Browse files
cxljsndyakov
authored andcommitted
chore: remove a redundant method (redis#3401)
Signed-off-by: fukua95 <[email protected]> Co-authored-by: Nedyalko Dyakov <[email protected]>
1 parent 179a267 commit 7d94a71

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
@@ -987,13 +987,6 @@ func (c *ClusterClient) Close() error {
987987
return c.nodes.Close()
988988
}
989989

990-
// Do create a Cmd from the args and processes the cmd.
991-
func (c *ClusterClient) Do(ctx context.Context, args ...interface{}) *Cmd {
992-
cmd := NewCmd(ctx, args...)
993-
_ = c.Process(ctx, cmd)
994-
return cmd
995-
}
996-
997990
func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error {
998991
err := c.processHook(ctx, cmd)
999992
cmd.SetErr(err)

osscluster_test.go

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

277277
assertClusterClient := func() {
278+
It("do", func() {
279+
val, err := client.Do(ctx, "ping").Result()
280+
Expect(err).NotTo(HaveOccurred())
281+
Expect(val).To(Equal("PONG"))
282+
})
283+
278284
It("should GET/SET/DEL", func() {
279285
err := client.Get(ctx, "A").Err()
280286
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)