Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly define flow signature in effe.go #20

Open
maratori opened this issue Oct 2, 2020 · 0 comments
Open

Explicitly define flow signature in effe.go #20

maratori opened this issue Oct 2, 2020 · 0 comments

Comments

@maratori
Copy link
Contributor

maratori commented Oct 2, 2020

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant