forked from mirror/redis
Merge pull request #447 from go-redis/fix/script-interface
Check that clients implement scripter interface.
This commit is contained in:
commit
ca08dfb44b
|
@ -328,8 +328,6 @@ type ClusterClient struct {
|
||||||
closed bool
|
closed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Cmdable = (*ClusterClient)(nil)
|
|
||||||
|
|
||||||
// NewClusterClient returns a Redis Cluster client as described in
|
// NewClusterClient returns a Redis Cluster client as described in
|
||||||
// http://redis.io/topics/cluster-spec.
|
// http://redis.io/topics/cluster-spec.
|
||||||
func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
func NewClusterClient(opt *ClusterOptions) *ClusterClient {
|
||||||
|
|
|
@ -236,6 +236,11 @@ type Cmdable interface {
|
||||||
Command() *CommandsInfoCmd
|
Command() *CommandsInfoCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ Cmdable = (*Client)(nil)
|
||||||
|
var _ Cmdable = (*Tx)(nil)
|
||||||
|
var _ Cmdable = (*Ring)(nil)
|
||||||
|
var _ Cmdable = (*ClusterClient)(nil)
|
||||||
|
|
||||||
type cmdable struct {
|
type cmdable struct {
|
||||||
process func(cmd Cmder) error
|
process func(cmd Cmder) error
|
||||||
}
|
}
|
||||||
|
|
2
redis.go
2
redis.go
|
@ -172,8 +172,6 @@ type Client struct {
|
||||||
cmdable
|
cmdable
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Cmdable = (*Client)(nil)
|
|
||||||
|
|
||||||
func newClient(opt *Options, pool pool.Pooler) *Client {
|
func newClient(opt *Options, pool pool.Pooler) *Client {
|
||||||
base := baseClient{opt: opt, connPool: pool}
|
base := baseClient{opt: opt, connPool: pool}
|
||||||
client := &Client{
|
client := &Client{
|
||||||
|
|
2
ring.go
2
ring.go
|
@ -136,8 +136,6 @@ type Ring struct {
|
||||||
closed bool
|
closed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Cmdable = (*Ring)(nil)
|
|
||||||
|
|
||||||
func NewRing(opt *RingOptions) *Ring {
|
func NewRing(opt *RingOptions) *Ring {
|
||||||
const nreplicas = 100
|
const nreplicas = 100
|
||||||
opt.init()
|
opt.init()
|
||||||
|
|
|
@ -14,6 +14,10 @@ type scripter interface {
|
||||||
ScriptLoad(script string) *StringCmd
|
ScriptLoad(script string) *StringCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ scripter = (*Client)(nil)
|
||||||
|
var _ scripter = (*Ring)(nil)
|
||||||
|
var _ scripter = (*ClusterClient)(nil)
|
||||||
|
|
||||||
type Script struct {
|
type Script struct {
|
||||||
src, hash string
|
src, hash string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue