activities

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChildWorkflowActivity

func NewChildWorkflowActivity(executor workflow.ChildWorkflowExecutor) workflow.Activity

NewChildWorkflowActivity creates a new ChildWorkflowActivity that can be used to execute child workflows

func NewFailActivity

func NewFailActivity() workflow.Activity

func NewJSONActivity

func NewJSONActivity() workflow.Activity

func NewPrintActivity

func NewPrintActivity() workflow.Activity

NewPrintActivity returns a print activity that writes to os.Stdout.

func NewPrintActivityTo added in v0.0.2

func NewPrintActivityTo(w io.Writer) workflow.Activity

NewPrintActivityTo returns a print activity that writes to w. If w is nil, os.Stdout is used.

func NewRandomActivity

func NewRandomActivity() workflow.Activity

func NewTimeActivity

func NewTimeActivity() workflow.Activity

Types

type ChildWorkflowActivity

type ChildWorkflowActivity struct {
	// contains filtered or unexported fields
}

ChildWorkflowActivity executes a registered child workflow synchronously.

func (*ChildWorkflowActivity) Execute

func (c *ChildWorkflowActivity) Execute(ctx workflow.Context, params ChildWorkflowInput) (map[string]any, error)

Execute runs the child workflow activity

func (*ChildWorkflowActivity) Name

func (c *ChildWorkflowActivity) Name() string

Name returns the activity name

type ChildWorkflowInput

type ChildWorkflowInput struct {
	WorkflowName string                 `json:"workflow_name"`
	Inputs       map[string]interface{} `json:"inputs"`
	Timeout      time.Duration          `json:"timeout"`
	ParentID     string                 `json:"parent_id"`
}

ChildWorkflowInput defines the input parameters for the child workflow activity.

The activity always runs the child synchronously: the parent step blocks until the child completes (or times out) and the result is stored under Step.Store. Workflows that need fire-and-forget behavior should call ChildWorkflowExecutor.ExecuteAsync directly from a custom activity.

type FailActivity

type FailActivity struct{}

FailActivity can be used to fail the workflow

func (*FailActivity) Execute

func (a *FailActivity) Execute(ctx workflow.Context, params FailInput) (FailOutput, error)

func (*FailActivity) Name

func (a *FailActivity) Name() string

type FailInput

type FailInput struct {
	Message string `json:"message"`
}

FailInput defines the input parameters for the fail activity

type FailOutput

type FailOutput struct{}

FailOutput defines the output of the fail activity

type JSONActivity

type JSONActivity struct{}

JSONActivity can be used to work with JSON data

func (*JSONActivity) Execute

func (a *JSONActivity) Execute(ctx workflow.Context, params JSONInput) (any, error)

func (*JSONActivity) Name

func (a *JSONActivity) Name() string

type JSONInput

type JSONInput struct {
	Operation string `json:"operation"`  // parse, stringify, query, merge, validate
	Data      string `json:"data"`       // JSON string to work with
	Query     string `json:"query"`      // JSONPath-like query (simplified)
	MergeWith string `json:"merge_with"` // JSON string to merge with
}

JSONInput defines the input parameters for the JSON activity

type PrintActivity

type PrintActivity struct {
	// contains filtered or unexported fields
}

PrintActivity prints a formatted message to a configurable writer. The default writer is os.Stdout; tests and embedded use cases can pass a different writer via NewPrintActivityTo.

func (*PrintActivity) Execute

func (a *PrintActivity) Execute(ctx workflow.Context, params PrintInput) (string, error)

func (*PrintActivity) Name

func (a *PrintActivity) Name() string

type PrintInput

type PrintInput struct {
	Message string `json:"message"`
	Args    []any  `json:"args"`
}

PrintInput defines the input parameters for the print activity

type RandomActivity

type RandomActivity struct{}

RandomActivity can be used to generate random values

func (*RandomActivity) Execute

func (a *RandomActivity) Execute(ctx workflow.Context, params RandomInput) (any, error)

func (*RandomActivity) Name

func (a *RandomActivity) Name() string

type RandomInput

type RandomInput struct {
	Type    string   `json:"type"`    // uuid, number, string, choice, boolean
	Min     float64  `json:"min"`     // minimum value for number generation
	Max     float64  `json:"max"`     // maximum value for number generation
	Length  int      `json:"length"`  // length for string generation
	Choices []string `json:"choices"` // choices for selection
	Count   int      `json:"count"`   // number of items to generate
	Charset string   `json:"charset"` // character set for string generation
	Seed    int64    `json:"seed"`    // seed for reproducible randomness
}

RandomInput defines the input parameters for the random activity

type TimeActivity

type TimeActivity struct{}

TimeActivity can be used to get the current time

func (*TimeActivity) Execute

func (a *TimeActivity) Execute(ctx workflow.Context, params TimeInput) (time.Time, error)

func (*TimeActivity) Name

func (a *TimeActivity) Name() string

type TimeInput

type TimeInput struct {
	UTC bool `json:"utc"`
}

TimeInput defines the input parameters for the get time activity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL