mirror of
https://github.com/redis/go-redis.git
synced 2025-04-16 09:23:06 +03:00
added Do
method for raw query by single conn from pool.Conn()
(#3182)
* added `Do` method for raw query by single conn from `pool.Conn()` * added test to cmdble Do method * fixed test * moved Do cmd to commands.go --------- Co-authored-by: Oleg Laktyushkin <oglaktyushkin@avito.ru> Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
This commit is contained in:
parent
97f7530415
commit
132818033b
@ -422,6 +422,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")
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user