From 0b706418d98c97e8e9588f7a62760ea6680c65ea Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 27 Sep 2016 09:24:14 +0000 Subject: [PATCH] Add Pipeline to Cmdable. --- cluster.go | 2 ++ commands.go | 5 +++-- redis.go | 2 ++ ring.go | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index 6aacd03..a53b793 100644 --- a/cluster.go +++ b/cluster.go @@ -39,6 +39,8 @@ type ClusterClient struct { reloading uint32 } +var _ Cmdable = (*ClusterClient)(nil) + // NewClusterClient returns a Redis Cluster client as described in // http://redis.io/topics/cluster-spec. func NewClusterClient(opt *ClusterOptions) *ClusterClient { diff --git a/commands.go b/commands.go index 99314b9..f117329 100644 --- a/commands.go +++ b/commands.go @@ -41,6 +41,9 @@ func formatSec(dur time.Duration) string { } type Cmdable interface { + Pipeline() *Pipeline + Pipelined(fn func(*Pipeline) error) ([]Cmder, error) + Echo(message interface{}) *StringCmd Ping() *StatusCmd Quit() *StatusCmd @@ -247,8 +250,6 @@ func (c *cmdable) WrapProcess(createWrapper func(oldProcess func(cmd Cmder) erro c.process = createWrapper(c.process) } -var _ Cmdable = (*cmdable)(nil) - type statefulCmdable struct { process func(cmd Cmder) error } diff --git a/redis.go b/redis.go index b8ceab5..ea0a2b4 100644 --- a/redis.go +++ b/redis.go @@ -150,6 +150,8 @@ type Client struct { cmdable } +var _ Cmdable = (*Client)(nil) + func newClient(opt *Options, pool pool.Pooler) *Client { base := baseClient{opt: opt, connPool: pool} client := &Client{ diff --git a/ring.go b/ring.go index 39733e2..5b2fdde 100644 --- a/ring.go +++ b/ring.go @@ -133,6 +133,8 @@ type Ring struct { closed bool } +var _ Cmdable = (*Ring)(nil) + func NewRing(opt *RingOptions) *Ring { const nreplicas = 100 opt.init()