Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ type conn struct {
baseClient
cmdable
statefulCmdable
hooks // TODO: inherit hooks
}

// Conn is like Client, but its pool contains single connection.
Expand All @@ -743,7 +744,15 @@ func newConn(ctx context.Context, opt *Options, connPool pool.Pooler) *Conn {
}

func (c *Conn) Process(ctx context.Context, cmd Cmder) error {
return c.baseClient.process(ctx, cmd)
return c.hooks.process(ctx, cmd, c.baseClient.process)
}

func (c *Conn) processPipeline(ctx context.Context, cmds []Cmder) error {
return c.hooks.processPipeline(ctx, cmds, c.baseClient.processPipeline)
}

func (c *Conn) processTxPipeline(ctx context.Context, cmds []Cmder) error {
return c.hooks.processTxPipeline(ctx, cmds, c.baseClient.processTxPipeline)
}

func (c *Conn) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error) {
Expand Down
5 changes: 5 additions & 0 deletions redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ var _ = Describe("Client", func() {

Expect(tm2).To(BeTemporally("==", tm))
})

It("should Conn", func() {
err := rdb.Conn(ctx).Get(ctx, "this-key-does-not-exist").Err()
Expect(err).To(Equal(redis.Nil))
})
})

var _ = Describe("Client timeout", func() {
Expand Down