Tweak doc

This commit is contained in:
Vladimir Mihailenco 2020-02-13 16:13:33 +02:00
parent 709e543f16
commit c01b1dcab8
2 changed files with 8 additions and 5 deletions

View File

@ -1,15 +1,15 @@
# Changelog # Changelog
## v7 WIP ## v7
- Tx.Pipeline now returns a non-transactional pipeline. Use Tx.TxPipeline for a transactional pipeline. - *Important*. Tx.Pipeline now returns a non-transactional pipeline. Use Tx.TxPipeline for a transactional pipeline.
- WrapProcess is replaced with more convenient AddHook that has access to context.Context. - WrapProcess is replaced with more convenient AddHook that has access to context.Context.
- WithContext now can not be used to create a shallow copy of the client. - WithContext now can not be used to create a shallow copy of the client.
- New methods ProcessContext, DoContext, and ExecContext. - New methods ProcessContext, DoContext, and ExecContext.
- Client respects Context.Deadline when setting net.Conn deadline. - Client respects Context.Deadline when setting net.Conn deadline.
- Client listens on Context.Done while waiting for a connection from the pool and returns an error when context context is cancelled. - Client listens on Context.Done while waiting for a connection from the pool and returns an error when context context is cancelled.
- Add PubSub.ChannelWithSubscriptions that sends `*Subscription` in addition to `*Message` to allow detecting reconnections. - Add PubSub.ChannelWithSubscriptions that sends `*Subscription` in addition to `*Message` to allow detecting reconnections.
- `time.Time` is now marshalled in RFC3339 format. `rdb.Get("foo").Time()` helper is added to parse time. - `time.Time` is now marshalled in RFC3339 format. `rdb.Get("foo").Time()` helper is added to parse the time.
- `SetLimiter` is removed and added `Options.Limiter` instead. - `SetLimiter` is removed and added `Options.Limiter` instead.
## v6.15 ## v6.15

7
tx.go
View File

@ -116,6 +116,7 @@ func (c *Tx) Unwatch(keys ...string) *StatusCmd {
return cmd return cmd
} }
// Pipeline creates a pipeline. Usually it is more convenient to use Pipelined.
func (c *Tx) Pipeline() Pipeliner { func (c *Tx) Pipeline() Pipeliner {
pipe := Pipeline{ pipe := Pipeline{
ctx: c.ctx, ctx: c.ctx,
@ -127,11 +128,13 @@ func (c *Tx) Pipeline() Pipeliner {
return &pipe return &pipe
} }
// Pipelined executes commands queued in the fn outside of the transaction.
// Use TxPipelined if you need transactional behavior.
func (c *Tx) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) { func (c *Tx) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) {
return c.Pipeline().Pipelined(fn) return c.Pipeline().Pipelined(fn)
} }
// TxPipelined executes commands queued in the fn in a transaction. // TxPipelined executes commands queued in the fn in the transaction.
// //
// When using WATCH, EXEC will execute commands only if the watched keys // When using WATCH, EXEC will execute commands only if the watched keys
// were not modified, allowing for a check-and-set mechanism. // were not modified, allowing for a check-and-set mechanism.
@ -143,7 +146,7 @@ func (c *Tx) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error) {
return c.TxPipeline().Pipelined(fn) return c.TxPipeline().Pipelined(fn)
} }
// TxPipeline creates a new pipeline. Usually it is more convenient to use TxPipelined. // TxPipeline creates a pipeline. Usually it is more convenient to use TxPipelined.
func (c *Tx) TxPipeline() Pipeliner { func (c *Tx) TxPipeline() Pipeliner {
pipe := Pipeline{ pipe := Pipeline{
ctx: c.ctx, ctx: c.ctx,