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
Index ¶
- func Conditions(cs ...Condition) *conditions
- func Or(conditions ...Condition) *orGroup
- func ParentCondition(parent NamedTask, expression string) *parentCondition
- func SleepCondition(duration time.Duration) *sleepCondition
- func UserEventCondition(eventKey string, expression string, opts ...UserEventConditionOpt) *userEventCondition
- type Condition
- type ConditionMulti
- type NamedTask
- type UserEventConditionOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Conditions ¶
func Conditions(cs ...Condition) *conditions
Conditions creates a new condition that is satisfied if all of the conditions are satisfied.
func Or ¶
func Or(conditions ...Condition) *orGroup
Or creates a new condition that is satisfied if any of the conditions in the group are satisfied. By default, conditions are evaluated as an intersection (AND). For more complex conditions, you can use Or to create a group of conditions that are evaluated as a union (OR).
func ParentCondition ¶
ParentCondition creates a new condition that is satisfied based on the output of the parent task in a DAG.
func SleepCondition ¶
SleepCondition creates a new condition that waits for a specified duration.
func UserEventCondition ¶
func UserEventCondition(eventKey string, expression string, opts ...UserEventConditionOpt) *userEventCondition
UserEventCondition creates a new condition that waits for a user event to occur. The eventKey is the key of the user event that the condition is waiting for. The expression is an optional CEL expression that can be used to filter the user event, such as `event.data.key == "value"`.
Types ¶
type Condition ¶
type Condition interface {
ToPB(action contracts.Action) *ConditionMulti
}
Condition represents a set of conditions to either trigger a task or satisfy a wait condition. Callers should not use Condition directly. Instead, you should use a condition wrapper, such as Conditions, SleepCondition, UserEventCondition, ParentCondition, Or.
type ConditionMulti ¶
type ConditionMulti struct {
SleepConditions []*contracts.SleepMatchCondition
UserEventConditions []*contracts.UserEventMatchCondition
ParentConditions []*contracts.ParentOverrideMatchCondition
}
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 UserEventConditionOpt ¶ added in v0.104.1
type UserEventConditionOpt func(*userEventCondition)
UserEventConditionOpt configures optional behavior on a UserEventCondition.
func WithConsiderEventsSince ¶ added in v0.104.1
func WithConsiderEventsSince(since time.Time) UserEventConditionOpt
WithConsiderEventsSince makes the condition also match events that were pushed after the given time but before the wait was registered (event lookback). Requires WithEventScope to be set as well.
func WithEventScope ¶ added in v0.104.1
func WithEventScope(scope string) UserEventConditionOpt
WithEventScope restricts the condition to events pushed with a matching scope.