Skip to content

Commit

Permalink
feat: support task options for pipe.Tap
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroara committed Aug 2, 2023
1 parent 7e8a078 commit 27b2ac7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pipe/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ func Tap[S any](fn TapFn[S]) *TapOp[S] {
}

// Convert the tap operator as a Pipe.
func (op *TapOp[S]) AsPipe() Pipe[S, S] {
func (op *TapOp[S]) AsPipe(opts ...task.Option) Pipe[S, S] {
return Map(func(ctx context.Context, el S) (S, error) {
var zero S
err := op.run(ctx, el)
if err != nil {
return zero, err
}
return el, nil
}).AsPipe()
}).AsPipe(opts...)
}

// Convert the tap operator as a task.
Expand Down

0 comments on commit 27b2ac7

Please sign in to comment.