Skip to content

Commit 1328180

Browse files
oleglactoOleg Laktyushkinndyakov
authored
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 <[email protected]> Co-authored-by: Nedyalko Dyakov <[email protected]>
1 parent 97f7530 commit 1328180

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: commands.go

+6
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ func (c cmdable) Ping(ctx context.Context) *StatusCmd {
422422
return cmd
423423
}
424424

425+
func (c cmdable) Do(ctx context.Context, args ...interface{}) *Cmd {
426+
cmd := NewCmd(ctx, args...)
427+
_ = c(ctx, cmd)
428+
return cmd
429+
}
430+
425431
func (c cmdable) Quit(_ context.Context) *StatusCmd {
426432
panic("not implemented")
427433
}

Diff for: commands_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ var _ = Describe("Commands", func() {
8484
Expect(ping.Val()).To(Equal("PONG"))
8585
})
8686

87+
It("should Ping with Do method", func() {
88+
result := client.Conn().Do(ctx, "PING")
89+
Expect(result.Err()).NotTo(HaveOccurred())
90+
Expect(result.Val()).To(Equal("PONG"))
91+
})
92+
8793
It("should Wait", func() {
8894
const wait = 3 * time.Second
8995

0 commit comments

Comments
 (0)