Skip to content

Commit

Permalink
Wrap with pipelines should return pipe type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Jan 18, 2018
1 parent fe7ab2f commit 7edbd9e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/input/wrap_with_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ func WrapWithPipeline(in Type, pipeConstructor pipeline.ConstructorFunc) (*WithP
}

// WrapWithPipelines wraps an input with a variadic number of pipelines.
func WrapWithPipelines(in Type, pipeConstructors ...pipeline.ConstructorFunc) (Type, error) {
func WrapWithPipelines(in Type, pipeConstructors ...pipeline.ConstructorFunc) (*WithPipeline, error) {
var err error
for _, ctor := range pipeConstructors {
if in, err = WrapWithPipeline(in, ctor); err != nil {
var pipe *WithPipeline
for i, ctor := range pipeConstructors {
if i == 0 {
if pipe, err = WrapWithPipeline(in, ctor); err != nil {
return nil, err
}
} else if pipe, err = WrapWithPipeline(pipe, ctor); err != nil {
return nil, err
}
}
return in, nil
return pipe, nil
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 7edbd9e

Please sign in to comment.