1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

pipeline now has its own interface "Pipelineable"

This commit is contained in:
Felipe Cavalcanti
2017-05-01 12:42:58 -03:00
parent 4c6e2ad9a0
commit 6fca4d5ad0
16 changed files with 70 additions and 42 deletions

View File

@ -61,7 +61,7 @@ func (c *baseClient) initConn(cn *pool.Conn) error {
// Temp client for Auth and Select.
client := newClient(c.opt, pool.NewSingleConnPool(cn))
_, err := client.Pipelined(func(pipe *Pipeline) error {
_, err := client.Pipelined(func(pipe Pipelineable) error {
if c.opt.Password != "" {
pipe.Auth(c.opt.Password)
}
@ -324,11 +324,11 @@ func (c *Client) PoolStats() *PoolStats {
}
}
func (c *Client) Pipelined(fn func(*Pipeline) error) ([]Cmder, error) {
func (c *Client) Pipelined(fn func(Pipelineable) error) ([]Cmder, error) {
return c.Pipeline().pipelined(fn)
}
func (c *Client) Pipeline() *Pipeline {
func (c *Client) Pipeline() Pipelineable {
pipe := Pipeline{
exec: c.pipelineExecer(c.pipelineProcessCmds),
}
@ -337,7 +337,7 @@ func (c *Client) Pipeline() *Pipeline {
return &pipe
}
func (c *Client) TxPipelined(fn func(*Pipeline) error) ([]Cmder, error) {
func (c *Client) TxPipelined(fn func(Pipelineable) error) ([]Cmder, error) {
return c.TxPipeline().pipelined(fn)
}