Tags: TanmoySG/go-steps
Tags
Added `UseArguments` field to specify which arguments to use [#6] Merge pull request #6 from TanmoySG/runner-func-sig-change --- Added `UseArguments` field to specify which arguments to use In this PR, added the feature to pick between previous step returned values, or current step's arguments or use both as arguments to run the current step. ```go var steps = gosteps.Step{ Name: "add", Function: funcs.Add, StepArgs: []interface{}{2, 3}, NextStep: gosteps.Steps{ Name: "sub", Function: funcs.Sub, StepArgs: []interface{}{4, 6}, UseArguments: gosteps.CurrentStepArgs, }, } ``` Available configurations for `UseArguments` ```go // only previous step return will be passed to current step as arguments PreviousStepReturns stepArgChainingType = "PreviousStepReturns" // only current step arguments (StepArgs) will be passed to current step as arguments CurrentStepArgs stepArgChainingType = "CurrentStepArgs" // both previous step returns and current step arguments (StepArgs) will be passed // to current step as arguments - previous step returns, followed by current step args, PreviousReturnsWithCurrentStepArgs stepArgChainingType = "PreviousReturnsWithCurrentStepArgs" // both previous step returns and current step arguments (StepArgs) will be passed // to current step as arguments - current step args, followed by previous step returns CurrentStepArgsWithPreviousReturns stepArgChainingType = "CurrentStepArgsWithPreviousReturns" ``` Also refactored and added Unit Tests.
Fix/Handle execution for no initial/entry step [#4] Merge pull request #4 from TanmoySG/fix-no-initial-step In v0.1-beta if there are no steps (no initial or subsequent steps) then the Execute() functions panics and exits. To Fix this adding a simple check to see if (initial) steps are not empty. If it is then no error is returned or no panics are caused. if len(steps) == 0 { return nil, nil }