NewPipelineExecutor creates a new executor from a series of other executors
(executors ...Executor)
| 52 | |
| 53 | // NewPipelineExecutor creates a new executor from a series of other executors |
| 54 | func NewPipelineExecutor(executors ...Executor) Executor { |
| 55 | if len(executors) == 0 { |
| 56 | return func(_ context.Context) error { |
| 57 | return nil |
| 58 | } |
| 59 | } |
| 60 | var rtn Executor |
| 61 | for _, executor := range executors { |
| 62 | if rtn == nil { |
| 63 | rtn = executor |
| 64 | } else { |
| 65 | rtn = rtn.Then(executor) |
| 66 | } |
| 67 | } |
| 68 | return rtn |
| 69 | } |
| 70 | |
| 71 | // NewConditionalExecutor creates a new executor based on conditions |
| 72 | func NewConditionalExecutor(conditional Conditional, trueExecutor Executor, falseExecutor Executor) Executor { |
searching dependent graphs…