-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Hello everyone.
Thank you very much for adding Cmds() - the ability to retrieve cmds currently in the pipeline.
I'm wondering, are there any plans to support adding multiple commands at once ? At the moment it's only possible to add a single cmd to the pipeline.
Right now our code looks like this:
for _, cmd := range redisPipe.Cmds() {
txw.parentTx.redisPipe.Process(cmd)
}
So essentially we're just iterating over each value in the loop, while inside .Process
it's simply appending the element to a slice:
func (c *Pipeline) Process(ctx context.Context, cmd Cmder) error {
c.cmds = append(c.cmds, cmd)
return nil
}
This naturally raises the question - would it be possible to provide a new method for the Pipeline
structure, for example, ProcessBatch
:
func (c *Pipeline) ProcessBatch(ctx context.Context, cmds ...Cmder) error {
c.cmds = append(c.cmds, cmds...)
return nil
}
Or, perhaps in some major version, consider replacing the cmd Cmder
param in the Process
method with a variadic version ?
Metadata
Metadata
Assignees
Labels
No labels