Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) Counting(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) Increment(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)
- func (svc *Mock) MockCounting(...) *Mock
- func (svc *Mock) MockIncrement(...) *Mock
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- type Service
- func (svc *Service) Counting(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) Increment(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- type ToDo
Constants ¶
const ( Hostname = continueflowapi.Hostname Version = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
Intermediate extends and customizes the generic base connector.
func NewIntermediate ¶
func NewIntermediate(impl ToDo) *Intermediate
NewIntermediate creates a new instance of the intermediate.
type Mock ¶
type Mock struct {
*Intermediate
// contains filtered or unexported fields
}
Mock is a mockable version of the microservice, allowing functions, event sinks and web handlers to be mocked.
func (*Mock) Counting ¶
Counting returns the workflow graph, or a mocked graph if MockCounting was called.
func (*Mock) Increment ¶
func (svc *Mock) Increment(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)
Increment executes the mock handler.
func (*Mock) MockCounting ¶
func (svc *Mock) MockCounting(handler func(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)) *Mock
MockCounting sets up a mock handler for the Counting workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockIncrement ¶
func (svc *Mock) MockIncrement(handler func(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)) *Mock
MockIncrement sets up a mock handler for Increment.
func (*Mock) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
}
Service implements continueflow.verify, exercising multi-turn flows via Continue.
func (*Service) Counting ¶
Counting defines a single-task workflow that increments counter and persists it across turns.
func (*Service) Increment ¶
func (svc *Service) Increment(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error)
Increment reads counter and writes counter+1 back via the Out suffix.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
Increment(ctx context.Context, flow *workflow.Flow, counter int) (counterOut int, err error) // MARKER: Increment
Counting(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Counting
}
ToDo is implemented by the service or mock.