Documentation
¶
Index ¶
- Variables
- func CreateTypedWorkflowInstance0[TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstance1[TInput, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstance2[TInput1, TInput2, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstance3[TInput1, TInput2, TInput3, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstanceNoResult0(ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstanceNoResult1[TInput any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstanceNoResult2[TInput1, TInput2 any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func CreateTypedWorkflowInstanceNoResult3[TInput1, TInput2, TInput3 any](ctx context.Context, c *Client, options WorkflowInstanceOptions, ...) (*workflow.Instance, error)
- func GetTypedWorkflowResult0[TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc0[TResult], ...) (TResult, error)
- func GetTypedWorkflowResult1[TInput, TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc1[TInput, TResult], ...) (TResult, error)
- func GetTypedWorkflowResult2[TInput1, TInput2, TResult any](ctx context.Context, c *Client, ...) (TResult, error)
- func GetTypedWorkflowResult3[TInput1, TInput2, TInput3, TResult any](ctx context.Context, c *Client, ...) (TResult, error)
- func GetWorkflowResult[T any](ctx context.Context, c *Client, instance *workflow.Instance, ...) (T, error)
- type Client
- func (c *Client) CancelWorkflowInstance(ctx context.Context, instance *workflow.Instance) error
- func (c *Client) CreateWorkflowInstance(ctx context.Context, options WorkflowInstanceOptions, wf workflow.Workflow, ...) (*workflow.Instance, error)
- func (c *Client) GetStats(ctx context.Context) (*backend.Stats, error)
- func (c *Client) GetWorkflowInstanceState(ctx context.Context, instance *workflow.Instance) (core.WorkflowInstanceState, error)
- func (c *Client) RemoveWorkflowInstance(ctx context.Context, instance *core.WorkflowInstance) error
- func (c *Client) RemoveWorkflowInstances(ctx context.Context, options ...backend.RemovalOption) error
- func (c *Client) SignalWorkflow(ctx context.Context, instanceID string, name string, arg any) error
- func (c *Client) StartAutoExpiration(ctx context.Context, delay time.Duration) error
- func (c *Client) WaitForWorkflowInstance(ctx context.Context, instance *workflow.Instance, timeout time.Duration) error
- type WorkflowInstanceOptions
Constants ¶
This section is empty.
Variables ¶
var ErrWorkflowCanceled = errors.New("workflow canceled")
ErrWorkflowCanceled is returned when a workflow was already canceled.
var ErrWorkflowTerminated = errors.New("workflow terminated")
ErrWorkflowTerminated is returned when a workflow was already terminated.
Functions ¶
func CreateTypedWorkflowInstance0 ¶
func CreateTypedWorkflowInstance0[TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFunc0[TResult]) (*workflow.Instance, error)
CreateTypedWorkflowInstance0 creates a workflow instance with no input parameters (type-safe).
func CreateTypedWorkflowInstance1 ¶
func CreateTypedWorkflowInstance1[TInput, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFunc1[TInput, TResult], input TInput) (*workflow.Instance, error)
CreateTypedWorkflowInstance1 creates a workflow instance with one input parameter (type-safe).
func CreateTypedWorkflowInstance2 ¶
func CreateTypedWorkflowInstance2[TInput1, TInput2, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFunc2[TInput1, TInput2, TResult], input1 TInput1, input2 TInput2) (*workflow.Instance, error)
CreateTypedWorkflowInstance2 creates a workflow instance with two input parameters (type-safe).
func CreateTypedWorkflowInstance3 ¶
func CreateTypedWorkflowInstance3[TInput1, TInput2, TInput3, TResult any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFunc3[TInput1, TInput2, TInput3, TResult], input1 TInput1, input2 TInput2, input3 TInput3) (*workflow.Instance, error)
CreateTypedWorkflowInstance3 creates a workflow instance with three input parameters (type-safe).
func CreateTypedWorkflowInstanceNoResult0 ¶
func CreateTypedWorkflowInstanceNoResult0(ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFuncNoResult0) (*workflow.Instance, error)
CreateTypedWorkflowInstanceNoResult0 creates a workflow instance with no input parameters that returns only error (type-safe).
func CreateTypedWorkflowInstanceNoResult1 ¶
func CreateTypedWorkflowInstanceNoResult1[TInput any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFuncNoResult1[TInput], input TInput) (*workflow.Instance, error)
CreateTypedWorkflowInstanceNoResult1 creates a workflow instance with one input parameter that returns only error (type-safe).
func CreateTypedWorkflowInstanceNoResult2 ¶
func CreateTypedWorkflowInstanceNoResult2[TInput1, TInput2 any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFuncNoResult2[TInput1, TInput2], input1 TInput1, input2 TInput2) (*workflow.Instance, error)
CreateTypedWorkflowInstanceNoResult2 creates a workflow instance with two input parameters that returns only error (type-safe).
func CreateTypedWorkflowInstanceNoResult3 ¶
func CreateTypedWorkflowInstanceNoResult3[TInput1, TInput2, TInput3 any](ctx context.Context, c *Client, options WorkflowInstanceOptions, wf workflow.WorkflowFuncNoResult3[TInput1, TInput2, TInput3], input1 TInput1, input2 TInput2, input3 TInput3) (*workflow.Instance, error)
CreateTypedWorkflowInstanceNoResult3 creates a workflow instance with three input parameters that returns only error (type-safe).
func GetTypedWorkflowResult0 ¶
func GetTypedWorkflowResult0[TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc0[TResult], instance *workflow.Instance, timeout time.Duration) (TResult, error)
GetTypedWorkflowResult0 gets the result of a workflow with no input parameters (type-safe).
func GetTypedWorkflowResult1 ¶
func GetTypedWorkflowResult1[TInput, TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc1[TInput, TResult], instance *workflow.Instance, timeout time.Duration) (TResult, error)
GetTypedWorkflowResult1 gets the result of a workflow with one input parameter (type-safe). It waits for the workflow to finish or until the timeout expires.
func GetTypedWorkflowResult2 ¶
func GetTypedWorkflowResult2[TInput1, TInput2, TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc2[TInput1, TInput2, TResult], instance *workflow.Instance, timeout time.Duration) (TResult, error)
GetTypedWorkflowResult2 gets the result of a workflow with two input parameters (type-safe).
func GetTypedWorkflowResult3 ¶
func GetTypedWorkflowResult3[TInput1, TInput2, TInput3, TResult any](ctx context.Context, c *Client, wf workflow.WorkflowFunc3[TInput1, TInput2, TInput3, TResult], instance *workflow.Instance, timeout time.Duration) (TResult, error)
GetTypedWorkflowResult3 gets the result of a workflow with three input parameters (type-safe).
func GetWorkflowResult ¶
func GetWorkflowResult[T any](ctx context.Context, c *Client, instance *workflow.Instance, timeout time.Duration) (T, error)
GetWorkflowResult gets the workflow result for the given workflow result. It first waits for the workflow to finish or until the given timeout has expired.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CancelWorkflowInstance ¶
CancelWorkflowInstance cancels a running workflow instance.
func (*Client) CreateWorkflowInstance ¶
func (c *Client) CreateWorkflowInstance(ctx context.Context, options WorkflowInstanceOptions, wf workflow.Workflow, args ...any) (*workflow.Instance, error)
CreateWorkflowInstance creates a new workflow instance of the given workflow.
func (*Client) GetWorkflowInstanceState ¶
func (c *Client) GetWorkflowInstanceState(ctx context.Context, instance *workflow.Instance) (core.WorkflowInstanceState, error)
GetWorkflowInstanceState returns the current state of the given workflow instance
func (*Client) RemoveWorkflowInstance ¶
RemoveWorkflowInstance removes the given workflow instance from the backend.
Instance needs to be in a completed state.
func (*Client) RemoveWorkflowInstances ¶
func (c *Client) RemoveWorkflowInstances(ctx context.Context, options ...backend.RemovalOption) error
RemoveWorkflowInstances removes completed workflow instances from the backend.
func (*Client) SignalWorkflow ¶
SignalWorkflow signals a running workflow instance.
func (*Client) StartAutoExpiration ¶
StartAutoExpiration starts a system workflow that will automatically expire workflow instances.
The workflow will run every `delay` and remove all workflow instances finished before Now() - `delay`.