From 4a828ac3d2c04870e022cecccee744fa5f9b783a Mon Sep 17 00:00:00 2001 From: yzprofile Date: Thu, 13 Oct 2016 11:48:43 +0800 Subject: [PATCH] fix broken cmdable interface of redis.Tx --- commands.go | 11 +++++++---- tx.go | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index f1173296..a9a6a351 100644 --- a/commands.go +++ b/commands.go @@ -40,10 +40,7 @@ func formatSec(dur time.Duration) string { return strconv.FormatInt(int64(dur/time.Second), 10) } -type Cmdable interface { - Pipeline() *Pipeline - Pipelined(fn func(*Pipeline) error) ([]Cmder, error) - +type BaseCmdable interface { Echo(message interface{}) *StringCmd Ping() *StatusCmd Quit() *StatusCmd @@ -238,6 +235,12 @@ type Cmdable interface { Command() *CommandsInfoCmd } +type Cmdable interface { + Pipeline() *Pipeline + Pipelined(fn func(*Pipeline) error) ([]Cmder, error) + BaseCmdable +} + type cmdable struct { process func(cmd Cmder) error } diff --git a/tx.go b/tx.go index 62e77018..5294d783 100644 --- a/tx.go +++ b/tx.go @@ -28,6 +28,8 @@ type Tx struct { closed bool } +var _ BaseCmdable = (*Tx)(nil) + func (c *Client) newTx() *Tx { tx := Tx{ baseClient: baseClient{