Summary
Let's change signature of the flow description in such way to explicitly define dependencies, arguments and return values.
Description
Description is based on test SimpleWIthDependencies.
Flow A is described in effe.go.
It implicitly defines:
- dependencies = arguments of
NewAImpl
- arguments = arguments of
AFunc
- return values = return values of
AFunc
Implicitly means that none of the above is defined in effe.go, but generates by cli tool.
And reader of effe.go file doesn't understand what they are.
I propose to change signature of flow function to be
func MyFLow([dependencies...]) func([arguments...]) [return values...] {
effe.BuildFlow(...)
return nil
}
So instead of generation signatures of NewAImpl and AFunc generator will just check that they match flow description.
Example
Test SimpleWIthDependencies will be changed.
FIles steps.go and effe_gen.go will remain the same.
File effe.go will be changed to
func A(UserRepository, NotificationRepository) func(string) error {
effe.BuildFlow(
effe.Step(step1),
effe.Step(step2),
)
return nil
}
from
|
func A() error { |
|
effe.BuildFlow( |
|
effe.Step(step1), |
|
effe.Step(step2), |
|
) |
|
return nil |
|
} |
Summary
Let's change signature of the flow description in such way to explicitly define dependencies, arguments and return values.
Description
Description is based on test SimpleWIthDependencies.
Flow
Ais described in effe.go.It implicitly defines:
NewAImplAFuncAFuncImplicitly means that none of the above is defined in effe.go, but generates by cli tool.
And reader of effe.go file doesn't understand what they are.
I propose to change signature of flow function to be
So instead of generation signatures of
NewAImplandAFuncgenerator will just check that they match flow description.Example
Test SimpleWIthDependencies will be changed.
FIles steps.go and effe_gen.go will remain the same.
File effe.go will be changed to
from
effe/testdata/SimpleWIthDependencies/foo/effe.go
Lines 7 to 13 in d8f24ab