1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Allow Pipelined funcs to return error.

This commit is contained in:
Vladimir Mihailenco
2014-07-02 16:18:19 +03:00
parent 4ea3e7531b
commit b11853c050
2 changed files with 8 additions and 4 deletions

View File

@ -20,9 +20,11 @@ func (c *Client) Pipeline() *Pipeline {
}
}
func (c *Client) Pipelined(f func(*Pipeline)) ([]Cmder, error) {
func (c *Client) Pipelined(f func(*Pipeline) error) ([]Cmder, error) {
pc := c.Pipeline()
f(pc)
if err := f(pc); err != nil {
return nil, err
}
cmds, err := pc.Exec()
pc.Close()
return cmds, err