Skip to content
Merged
6 changes: 6 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ func (c cmdable) Ping(ctx context.Context) *StatusCmd {
return cmd
}

func (c cmdable) Do(ctx context.Context, args ...interface{}) *Cmd {
cmd := NewCmd(ctx, args...)
_ = c(ctx, cmd)
return cmd
}

func (c cmdable) Quit(_ context.Context) *StatusCmd {
panic("not implemented")
}
Expand Down
6 changes: 6 additions & 0 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ var _ = Describe("Commands", func() {
Expect(ping.Val()).To(Equal("PONG"))
})

It("should Ping with Do method", func() {
result := client.Conn().Do(ctx, "PING")
Expect(result.Err()).NotTo(HaveOccurred())
Expect(result.Val()).To(Equal("PONG"))
})

It("should Wait", func() {
const wait = 3 * time.Second

Expand Down
Loading