Skip to content

Explicitly define flow signature in effe.go #20

@maratori

Description

@maratori

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions