Source File
tx.go
Belonging Package
github.com/go-redis/redis/v8
package redis
import (
)
const TxFailedErr = proto.RedisError("redis: transaction failed")
type Tx struct {
baseClient
cmdable
statefulCmdable
hooks
ctx context.Context
}
func ( *Client) ( context.Context) *Tx {
:= Tx{
baseClient: baseClient{
opt: .opt,
connPool: pool.NewStickyConnPool(.connPool),
},
hooks: .hooks.clone(),
ctx: ,
}
.init()
return &
}
func ( *Tx) () {
.cmdable = .Process
.statefulCmdable = .Process
}
func ( *Tx) () context.Context {
return .ctx
}
func ( *Tx) ( context.Context) *Tx {
if == nil {
panic("nil context")
}
:= *
.init()
.hooks.lock()
.ctx =
return &
}
func ( *Tx) ( context.Context, Cmder) error {
return .hooks.process(, , .baseClient.process)
}
func ( *Tx) () Pipeliner {
:= Pipeline{
ctx: .ctx,
exec: func( context.Context, []Cmder) error {
return .hooks.processPipeline(, , .baseClient.processPipeline)
},
}
.init()
return &
}
func ( *Tx) () Pipeliner {
:= Pipeline{
ctx: .ctx,
exec: func( context.Context, []Cmder) error {
return .hooks.processTxPipeline(, , .baseClient.processTxPipeline)
},
}
.init()
return &
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |