Source File
pipeline.go
Belonging Package
github.com/go-redis/redis/v8
package redis
import (
)
type pipelineExecer func(context.Context, []Cmder) error
type Pipeline struct {
cmdable
statefulCmdable
ctx context.Context
exec pipelineExecer
mu sync.Mutex
cmds []Cmder
closed bool
}
func ( *Pipeline) () {
.cmdable = .Process
.statefulCmdable = .Process
}
func ( *Pipeline) ( context.Context, ...interface{}) *Cmd {
:= NewCmd(, ...)
_ = .Process(, )
return
}
func ( *Pipeline) ( context.Context) ([]Cmder, error) {
.mu.Lock()
defer .mu.Unlock()
if .closed {
return nil, pool.ErrClosed
}
if len(.cmds) == 0 {
return nil, nil
}
:= .cmds
.cmds = nil
return , .exec(, )
}
func ( *Pipeline) ( context.Context, func(Pipeliner) error) ([]Cmder, error) {
if := (); != nil {
return nil,
}
, := .Exec()
_ = .Close()
return ,
}
func ( *Pipeline) () Pipeliner {
return
}
func ( *Pipeline) ( context.Context, func(Pipeliner) error) ([]Cmder, error) {
return .Pipelined(, )
}
func ( *Pipeline) () Pipeliner {
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. |