Help us shape the future of Go! Take the 2026 Go Developer Survey

create

package
v0.112.16 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Deprecated: This package is part of the legacy v0 workflow definition system. Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go

Deprecated: This package is part of the legacy v0 workflow definition system. 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

This section is empty.

Types

type BaseTaskCreateOpts

type BaseTaskCreateOpts[I any] struct {
}

type IdempotencyConfig added in v0.95.0

type IdempotencyConfig struct {
	// Expression is a CEL expression evaluated against the workflow input to produce an idempotency key.
	Expression string

	// TTL is the duration during which duplicate runs with the same key are rejected.
	// When Method is STATUS, this acts as a fallback: the longest the key can live before it's evicted.
	TTL time.Duration

	// Method determines how the idempotency key's lifetime is managed. Defaults to TTL.
	Method IdempotencyMethod
}

IdempotencyConfig configures idempotency behavior for a workflow.

type IdempotencyMethod added in v0.96.0

type IdempotencyMethod string

IdempotencyMethod determines how the lifetime of an idempotency key is managed.

const (
	// IdempotencyMethodTTL evicts the idempotency key after a fixed time-to-live window.
	IdempotencyMethodTTL IdempotencyMethod = "TTL"

	// IdempotencyMethodStatus keeps the idempotency key alive until the associated run
	// reaches a terminal status. TTL acts as a fallback that caps how long the key can live.
	IdempotencyMethodStatus IdempotencyMethod = "STATUS"
)

type NamedTask

type NamedTask interface {
	// GetName returns the name of the task
	GetName() string
}

NamedTask defines an interface for task types that have a name

type StandaloneDurableTaskCreateOpts

type StandaloneDurableTaskCreateOpts[I, O any] struct {
	StandaloneTask
	// (required) The function to execute when the task runs
	Fn interface{}
}

DurableTaskCreateOpts defines options for creating a standalone durable task. This combines both workflow and durable task properties in a single type.

type StandaloneTask

type StandaloneTask struct {

	// (required) The name of the task and workflow
	Name string

	// (optional) The version of the workflow
	Version string

	// (optional) The human-readable description of the workflow
	Description string

	// (optional) ExecutionTimeout specifies the maximum duration a task can run before being terminated
	ExecutionTimeout time.Duration

	// (optional) ScheduleTimeout specifies the maximum time a task can wait to be scheduled
	ScheduleTimeout time.Duration

	// (optional) Retries defines the number of times to retry a failed task
	Retries int32

	// (optional) RetryBackoffFactor is the multiplier for increasing backoff between retries
	RetryBackoffFactor float32

	// (optional) RetryMaxBackoffSeconds is the maximum backoff duration in seconds between retries
	RetryMaxBackoffSeconds int32

	// (optional) RateLimits define constraints on how frequently the task can be executed
	RateLimits []*types.RateLimit

	// (optional) WorkerLabels specify requirements for workers that can execute this task
	WorkerLabels map[string]*types.DesiredWorkerLabel

	// (optional) Concurrency defines constraints on how many instances of this task can run simultaneously
	Concurrency []*types.Concurrency

	// (optional) The event names that trigger the workflow
	OnEvents []string

	// (optional) The cron expressions for scheduled workflow runs
	OnCron []string

	DefaultPriority *int32

	DefaultFilters []types.DefaultFilter
}

TaskCreateOpts defines options for creating a standalone task. This combines both workflow and task properties in a single type.

type TaskDefaults

type TaskDefaults struct {
	// (optional) ExecutionTimeout specifies the maximum duration a task can run after starting before being terminated
	ExecutionTimeout time.Duration

	// (optional) ScheduleTimeout specifies the maximum time a task can wait in the queue to be scheduled
	ScheduleTimeout time.Duration

	// (optional) Retries defines the number of times to retry a failed task
	Retries int32

	// (optional) RetryBackoffFactor is the multiplier for increasing backoff between retries
	RetryBackoffFactor float32

	// (optional) RetryMaxBackoffSeconds is the maximum backoff duration in seconds between retries
	RetryMaxBackoffSeconds int32
}

TaskDefaults defines default configuration values for tasks within a workflow.

type WorkflowCreateOpts

type WorkflowCreateOpts[I any] struct {
	// (required) The friendly name of the workflow
	Name string

	// (optional) The version of the workflow
	Version string

	// (optional) The human-readable description of the workflow
	Description string

	// (optional) The event names that trigger the workflow
	OnEvents []string

	// (optional) The cron expressions for scheduled workflow runs
	OnCron []string

	// (optional) The JSON-serialized input for cron workflows (defaults to "{}" if nil)
	CronInput *string

	// (optional) Concurrency settings to control parallel execution
	Concurrency []types.Concurrency

	// (optional) Strategy for sticky execution of workflow runs
	StickyStrategy *types.StickyStrategy

	// (optional) Default settings for all tasks within this workflow
	TaskDefaults *TaskDefaults

	// (optional) The key to use for the output of the workflow (i.e. the name of the fn where O is the output type)
	OutputKey *string

	// (optional) The default priority for tasks in this workflow
	DefaultPriority *int32

	DefaultFilters []types.DefaultFilter

	// (optional) Idempotency configuration for preventing duplicate runs
	Idempotency *IdempotencyConfig
}

WorkflowCreateOpts contains configuration options for creating a new workflow.

type WorkflowOnFailureTask

type WorkflowOnFailureTask[I, O any] struct {
	// (optional) The version of the workflow
	Version string

	// (optional) The human-readable description of the workflow
	Description string

	// (optional) ExecutionTimeout specifies the maximum duration a task can run before being terminated
	ExecutionTimeout time.Duration

	// (optional) ScheduleTimeout specifies the maximum time a task can wait to be scheduled
	ScheduleTimeout time.Duration

	// (optional) Retries defines the number of times to retry a failed task
	Retries int32

	// (optional) RetryBackoffFactor is the multiplier for increasing backoff between retries
	RetryBackoffFactor float32

	// (optional) RetryMaxBackoffSeconds is the maximum backoff duration in seconds between retries
	RetryMaxBackoffSeconds int32

	// (optional) RateLimits define constraints on how frequently the task can be executed
	RateLimits []*types.RateLimit

	// (optional) WorkerLabels specify requirements for workers that can execute this task
	WorkerLabels map[string]*types.DesiredWorkerLabel

	// (optional) Concurrency defines constraints on how many instances of this task can run simultaneously
	Concurrency []*types.Concurrency
}

type WorkflowTask

type WorkflowTask[I, O any] struct {
	// (required) The name of the task and workflow
	Name string

	// (optional) The version of the workflow
	Version string

	// (optional) The human-readable description of the workflow
	Description string

	// (optional) ExecutionTimeout specifies the maximum duration a task can run before being terminated
	ExecutionTimeout time.Duration

	// (optional) ScheduleTimeout specifies the maximum time a task can wait to be scheduled
	ScheduleTimeout time.Duration

	// (optional) Retries defines the number of times to retry a failed task
	Retries int32

	// (optional) RetryBackoffFactor is the multiplier for increasing backoff between retries
	RetryBackoffFactor float32

	// (optional) RetryMaxBackoffSeconds is the maximum backoff duration in seconds between retries
	RetryMaxBackoffSeconds int32

	// (optional) RateLimits define constraints on how frequently the task can be executed
	RateLimits []*types.RateLimit

	// (optional) WorkerLabels specify requirements for workers that can execute this task
	WorkerLabels map[string]*types.DesiredWorkerLabel

	// (optional) Concurrency defines constraints on how many instances of this task can run simultaneously
	Concurrency []*types.Concurrency

	// WaitFor represents a set of conditions which must be satisfied before the task can run.
	WaitFor condition.Condition

	// SkipIf represents a set of conditions which, if satisfied, will cause the task to be skipped.
	SkipIf condition.Condition

	// CancelIf represents a set of conditions which, if satisfied, will cause the task to be canceled.
	CancelIf condition.Condition

	// (optional) Parents are the tasks that must successfully complete before this task can start
	Parents []NamedTask

	DefaultPriority *int32

	// (optional) SlotCost is the number of default worker slots this task consumes. Defaults to one.
	// Durable tasks ignore it.
	SlotCost *int32
}

Jump to

Keyboard shortcuts

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