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

Experimental: provide functional interface/struct to define workflow #22

Open
longquanzheng opened this issue Jan 5, 2023 · 0 comments

Comments

@longquanzheng
Copy link
Contributor

This is a comment/idea from a Temporal user:

The natural way to build abstractions in Go is to use higher order functions instead of OOP style classes-like structs and interfaces (the latter of course have their place but more for the consumer than producer side)
So, e.g. instead of implementing a "class" (struct) per state you could have something like this

var sm iwf.StaMa[StateType] := iwf.NewStaMa("sm-id", initialState, iwf.WithPersistanceOptions(...))

sm.AddState("state-id-1", func(...) {
 // some logic
 return "the-next-state"
}, iwf.WithSomeOption(...))
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