workflow

package
v0.78.15 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Deprecated: This package is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunChildWorkflow

func RunChildWorkflow[I any, O any](
	ctx worker.HatchetContext,
	workflow WorkflowDeclaration[I, O],
	input I,
	opts ...v0Client.RunOptFunc,
) (*O, error)

RunChildWorkflow is a helper function to run a child workflow with full type safety It takes the parent context, the child workflow declaration, and input Returns the typed output of the child workflow

Types

type DurableWrappedTaskFn deprecated

type DurableWrappedTaskFn func(ctx worker.DurableHatchetContext) (interface{}, error)

Deprecated: DurableWrappedTaskFn is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

type NamedFunction deprecated

type NamedFunction struct {
	ActionID string
	Fn       WrappedTaskFn
}

Deprecated: NamedFunction is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

type RunAsChildOpts deprecated

type RunAsChildOpts struct {
	RunOpts
	Sticky *bool
	Key    *string
}

Deprecated: RunAsChildOpts is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

type RunOpts deprecated

type RunOpts struct {
	AdditionalMetadata *map[string]interface{}
	Priority           *int32
}

Deprecated: RunOpts is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

type TaskWithSpecificOutput

type TaskWithSpecificOutput[I any, T any] struct {
	Name string
	Fn   func(ctx worker.HatchetContext, input I) (*T, error)
}

Define a TaskDeclaration with specific output type

type WorkflowBase deprecated

type WorkflowBase interface {
	// Dump converts the workflow declaration into a protobuf request and function mappings.
	// Returns the workflow definition, regular task functions, durable task functions, and the on failure task function.
	Dump() (*contracts.CreateWorkflowVersionRequest, []NamedFunction, []NamedFunction, WrappedTaskFn)
}

Deprecated: WorkflowBase is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

type WorkflowDeclaration deprecated

type WorkflowDeclaration[I, O any] interface {
	WorkflowBase

	// Task registers a task that will be executed as part of the workflow
	Task(opts create.WorkflowTask[I, O], fn func(ctx worker.HatchetContext, input I) (interface{}, error)) *task.TaskDeclaration[I]

	// DurableTask registers a durable task that will be executed as part of the workflow.
	// Durable tasks can be paused and resumed across workflow runs, making them suitable
	// for long-running operations or tasks that require human intervention.
	DurableTask(opts create.WorkflowTask[I, O], fn func(ctx worker.DurableHatchetContext, input I) (interface{}, error)) *task.DurableTaskDeclaration[I]

	// OnFailureTask registers a task that will be executed if the workflow fails.
	OnFailure(opts create.WorkflowOnFailureTask[I, O], fn func(ctx worker.HatchetContext, input I) (interface{}, error)) *task.OnFailureTaskDeclaration[I]

	// Run executes the workflow with the provided input.
	Run(ctx context.Context, input I, opts ...v0Client.RunOptFunc) (*O, error)

	// RunChild executes a child workflow with the provided input.
	RunAsChild(ctx worker.HatchetContext, input I, opts RunAsChildOpts) (*O, error)

	// RunNoWait executes the workflow with the provided input without waiting for it to complete.
	// Instead it returns a run ID that can be used to check the status of the workflow.
	RunNoWait(ctx context.Context, input I, opts ...v0Client.RunOptFunc) (*v0Client.Workflow, error)

	// RunBulkNoWait executes the workflow with the provided inputs without waiting for them to complete.
	RunBulkNoWait(ctx context.Context, input []I, opts ...v0Client.RunOptFunc) ([]string, error)

	// Cron schedules the workflow to run on a regular basis using a cron expression.
	Cron(ctx context.Context, name string, cronExpr string, input I, opts ...v0Client.RunOptFunc) (*rest.CronWorkflows, error)

	// Schedule schedules the workflow to run at a specific time.
	Schedule(ctx context.Context, triggerAt time.Time, input I, opts ...v0Client.RunOptFunc) (*rest.ScheduledWorkflows, error)

	// Get retrieves the current state of the workflow.
	Get(ctx context.Context) (*rest.Workflow, error)

	// Metrics retrieves metrics for this workflow.
	Metrics(ctx context.Context, opts ...rest.WorkflowGetMetricsParams) (*rest.WorkflowMetrics, error)

	// QueueMetrics retrieves queue metrics for this workflow.
	QueueMetrics(ctx context.Context, opts ...rest.TenantGetQueueMetricsParams) (*rest.TenantGetQueueMetricsResponse, error)
}

Deprecated: WorkflowDeclaration is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

func NewWorkflowDeclaration

func NewWorkflowDeclaration[I any, O any](opts create.WorkflowCreateOpts[I], v0 v0Client.Client) WorkflowDeclaration[I, O]

NewWorkflowDeclaration creates a new workflow declaration with the specified options and client. The workflow will have input type I and output type O.

type WrappedTaskFn deprecated

type WrappedTaskFn func(ctx worker.HatchetContext) (interface{}, error)

Deprecated: WrappedTaskFn is part of the old generics-based v1 Go SDK. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

Jump to

Keyboard shortcuts

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