activities

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 18 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 NewFileActivity

func NewFileActivity() workflow.Activity

func NewHTTPActivity

func NewHTTPActivity() workflow.Activity

func NewJSONActivity

func NewJSONActivity() workflow.Activity

func NewPrintActivity

func NewPrintActivity() workflow.Activity

func NewRandomActivity

func NewRandomActivity() workflow.Activity

func NewScriptActivity

func NewScriptActivity() workflow.Activity

func NewShellActivity

func NewShellActivity() workflow.Activity

func NewTimeActivity

func NewTimeActivity() workflow.Activity

func NewWaitActivity

func NewWaitActivity() workflow.Activity

Types

type ChildWorkflowActivity

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

ChildWorkflowActivity can be used to execute child workflows

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"`
	Sync         bool                   `json:"sync"`
	Inputs       map[string]interface{} `json:"inputs"`
	Timeout      float64                `json:"timeout"`
	ParentID     string                 `json:"parent_id"`
}

ChildWorkflowInput defines the input parameters for the child workflow 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 FileActivity

type FileActivity struct{}

FileActivity can be used to perform file operations

func (*FileActivity) Execute

func (a *FileActivity) Execute(ctx workflow.Context, params FileInput) (any, error)

func (*FileActivity) Name

func (a *FileActivity) Name() string

type FileInput

type FileInput struct {
	Operation   string `json:"operation"`   // read, write, append, delete, exists, mkdir, list
	Path        string `json:"path"`        // file or directory path
	Content     string `json:"content"`     // content to write (for write/append operations)
	Permissions string `json:"permissions"` // file permissions (e.g., "0644", "0755")
	CreateDirs  bool   `json:"create_dirs"` // create parent directories if they don't exist
}

FileInput defines the input parameters for the file activity

type HTTPActivity

type HTTPActivity struct{}

HTTPActivity can be used to make HTTP requests

func (*HTTPActivity) Execute

func (a *HTTPActivity) Execute(ctx workflow.Context, params HTTPInput) (HTTPOutput, error)

func (*HTTPActivity) Name

func (a *HTTPActivity) Name() string

type HTTPInput

type HTTPInput struct {
	URL             string            `json:"url"`
	Method          string            `json:"method"` // GET, POST, PUT, DELETE, etc.
	Headers         map[string]string `json:"headers"`
	Body            string            `json:"body"`             // JSON string or plain text
	JSONPayload     map[string]any    `json:"json_payload"`     // Alternative to body for JSON
	Timeout         float64           `json:"timeout"`          // in seconds, default 30
	FollowRedirects bool              `json:"follow_redirects"` // default true
}

HTTPInput defines the input parameters for the HTTP activity

type HTTPOutput

type HTTPOutput struct {
	StatusCode    int               `json:"status_code"`
	Status        string            `json:"status"`
	Headers       map[string]string `json:"headers"`
	Body          string            `json:"body"`
	JSONResponse  map[string]any    `json:"json_response,omitempty"`
	Success       bool              `json:"success"`
	ContentLength int64             `json:"content_length"`
}

HTTPOutput defines the output of the HTTP 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{}

PrintActivity can be used to print a message to the console

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 ScriptActivity

type ScriptActivity struct{}

ScriptActivity executes a script.

func (*ScriptActivity) Execute

func (a *ScriptActivity) Execute(ctx workflow.Context, params ScriptParams) (any, error)

func (*ScriptActivity) Name

func (a *ScriptActivity) Name() string

type ScriptParams

type ScriptParams struct {
	Code string `json:"code"`
}

ScriptParams defines the parameters for the script activity

type ShellActivity

type ShellActivity struct{}

ShellActivity can be used to execute shell commands

func (*ShellActivity) Execute

func (a *ShellActivity) Execute(ctx workflow.Context, params ShellInput) (map[string]any, error)

func (*ShellActivity) Name

func (a *ShellActivity) Name() string

type ShellInput

type ShellInput struct {
	Command     string            `json:"command"`
	Args        []string          `json:"args"`
	WorkingDir  string            `json:"working_dir"`
	Environment map[string]string `json:"environment"`
	Timeout     float64           `json:"timeout"` // in seconds, 0 means no timeout
}

ShellInput defines the input parameters for the shell 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

type WaitActivity

type WaitActivity struct{}

WaitActivity can be used to wait for a duration

func (*WaitActivity) Execute

func (a *WaitActivity) Execute(ctx workflow.Context, params WaitInput) (string, error)

func (*WaitActivity) Name

func (a *WaitActivity) Name() string

type WaitInput

type WaitInput struct {
	Seconds float64 `json:"seconds"`
}

WaitInput defines the input parameters for the wait activity

Jump to

Keyboard shortcuts

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