Skip to content

Commit 6e5adac

Browse files
author
Oleg Laktyushkin
committed
moved Do cmd to commands.go
1 parent e301dad commit 6e5adac

File tree

4 files changed

+12
-36
lines changed

4 files changed

+12
-36
lines changed

commands.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ func (c cmdable) Ping(ctx context.Context) *StatusCmd {
423423
return cmd
424424
}
425425

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

commands_test.go

Lines changed: 6 additions & 1 deletion
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

@@ -2659,7 +2665,6 @@ var _ = Describe("Commands", func() {
26592665
Expect(res).To(Equal([]int64{1, 1, -2}))
26602666
})
26612667

2662-
26632668
It("should HPExpire", Label("hash-expiration", "NonRedisEnterprise"), func() {
26642669
SkipBeforeRedisVersion(7.4, "doesn't work with older redis stack images")
26652670
res, err := client.HPExpire(ctx, "no_such_key", 10*time.Second, "field1", "field2", "field3").Result()

do.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

do_test.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)