diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-08-28 10:05:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 10:05:26 -0700 |
commit | 61e27beabc9804fdcf59ed9df2180802175a4f70 (patch) | |
tree | 52c86f5cdbd4e13d05b8f9dddad1a01b88e26cab /vendor/github.com/go-redis/redis/tx.go | |
parent | 347ee1d205c95f5fd766e206cc65bfb9782a2623 (diff) | |
download | chat-61e27beabc9804fdcf59ed9df2180802175a4f70.tar.gz chat-61e27beabc9804fdcf59ed9df2180802175a4f70.tar.bz2 chat-61e27beabc9804fdcf59ed9df2180802175a4f70.zip |
Updating dependancies. (#9303)
Diffstat (limited to 'vendor/github.com/go-redis/redis/tx.go')
-rw-r--r-- | vendor/github.com/go-redis/redis/tx.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/go-redis/redis/tx.go b/vendor/github.com/go-redis/redis/tx.go index 6a753b6a0..6a7da99dd 100644 --- a/vendor/github.com/go-redis/redis/tx.go +++ b/vendor/github.com/go-redis/redis/tx.go @@ -29,6 +29,10 @@ func (c *Client) newTx() *Tx { return &tx } +// Watch prepares a transcaction and marks the keys to be watched +// for conditional execution if there are any keys. +// +// The transaction is automatically closed when the fn exits. func (c *Client) Watch(fn func(*Tx) error, keys ...string) error { tx := c.newTx() if len(keys) > 0 { @@ -74,6 +78,7 @@ func (c *Tx) Unwatch(keys ...string) *StatusCmd { return cmd } +// Pipeline creates a new pipeline. It is more convenient to use Pipelined. func (c *Tx) Pipeline() Pipeliner { pipe := Pipeline{ exec: c.processTxPipeline, @@ -82,23 +87,24 @@ func (c *Tx) Pipeline() Pipeliner { return &pipe } -// Pipelined executes commands queued in the fn in a transaction -// and restores the connection state to normal. +// Pipelined executes commands queued in the fn in a transaction. // // When using WATCH, EXEC will execute commands only if the watched keys // were not modified, allowing for a check-and-set mechanism. // // Exec always returns list of commands. If transaction fails -// TxFailedErr is returned. Otherwise Exec returns error of the first +// TxFailedErr is returned. Otherwise Exec returns an error of the first // failed command or nil. func (c *Tx) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) { return c.Pipeline().Pipelined(fn) } +// TxPipelined is an alias for Pipelined. func (c *Tx) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error) { return c.Pipelined(fn) } +// TxPipeline is an alias for Pipeline. func (c *Tx) TxPipeline() Pipeliner { return c.Pipeline() } |