You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crate/exegroup/actor.go

35 lines
567 B
Go

package exegroup
import "context"
type (
GoFunc = func(ctx context.Context) error
StopFunc = func(ctx context.Context)
)
type Actor struct {
goFunc GoFunc
stopFunc StopFunc
name string
}
func NewActor() *Actor {
return &Actor{}
}
func (actor *Actor) WithName(name string) *Actor {
actor.name = name
return actor
}
func (actor *Actor) WithGo(goFunc GoFunc) *Actor {
actor.goFunc = goFunc
return actor
}
func (actor *Actor) WithGoStop(goFunc GoFunc, stopFunc StopFunc) *Actor {
actor.goFunc = goFunc
actor.stopFunc = stopFunc
return actor
}