Skip to content

added Do method for raw query by single conn from pool.Conn() #3182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 24, 2025
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