diff --git a/examples/go/bulk-operations/main.go b/examples/go/bulk-operations/main.go index ef17f4b35..38621a5da 100644 --- a/examples/go/bulk-operations/main.go +++ b/examples/go/bulk-operations/main.go @@ -35,6 +35,7 @@ func main() { selectedWorkflow := (*workflows.Rows)[0] selectedWorkflowUUID := uuid.MustParse(selectedWorkflow.Metadata.Id) + // > List runs workflowRuns, err := hatchet.Runs().List(ctx, rest.V1WorkflowRunListParams{ WorkflowIds: &[]types.UUID{selectedWorkflowUUID}, @@ -49,6 +50,7 @@ func main() { runIds = append(runIds, uuid.MustParse(run.Metadata.Id)) } + // > Cancel by run ids _, err = hatchet.Runs().Cancel(ctx, rest.V1CancelTaskRequest{ ExternalIds: &runIds, @@ -57,6 +59,7 @@ func main() { log.Fatalf("failed to cancel runs by ids: %v", err) } + // > Cancel by filters tNow := time.Now().UTC() @@ -73,5 +76,6 @@ func main() { log.Fatalf("failed to cancel runs by filters: %v", err) } + fmt.Println("cancelled all runs for workflow", selectedWorkflow.Name) } diff --git a/examples/go/streaming/consumer/main.go b/examples/go/streaming/consumer/main.go index 1fcb2887f..8ee008885 100644 --- a/examples/go/streaming/consumer/main.go +++ b/examples/go/streaming/consumer/main.go @@ -37,3 +37,4 @@ func main() { fmt.Println("\nStreaming completed!") } + diff --git a/examples/go/streaming/server/main.go b/examples/go/streaming/server/main.go index d82959c5a..c558216db 100644 --- a/examples/go/streaming/server/main.go +++ b/examples/go/streaming/server/main.go @@ -58,3 +58,4 @@ func main() { log.Println("Failed to start server:", err) } } + diff --git a/examples/go/streaming/shared/task.go b/examples/go/streaming/shared/task.go index b080638d2..552c2a180 100644 --- a/examples/go/streaming/shared/task.go +++ b/examples/go/streaming/shared/task.go @@ -50,6 +50,7 @@ func StreamTask(ctx worker.HatchetContext, input StreamTaskInput) (*StreamTaskOu }, nil } + func StreamingWorkflow(hatchet v1.HatchetClient) workflow.WorkflowDeclaration[StreamTaskInput, StreamTaskOutput] { return factory.NewTask( create.StandaloneTask{ diff --git a/examples/go/workflows/on-event.go b/examples/go/workflows/on-event.go index bea5aa68c..93d012f60 100644 --- a/examples/go/workflows/on-event.go +++ b/examples/go/workflows/on-event.go @@ -43,6 +43,7 @@ func Lower(hatchet v1.HatchetClient) workflow.WorkflowDeclaration[EventInput, Lo ) } + // > Accessing the filter payload func accessFilterPayload(ctx worker.HatchetContext, input EventInput) (*LowerTaskOutput, error) { fmt.Println(ctx.FilterPayload()) @@ -51,6 +52,7 @@ func accessFilterPayload(ctx worker.HatchetContext, input EventInput) (*LowerTas }, nil } + // > Declare with filter func LowerWithFilter(hatchet v1.HatchetClient) workflow.WorkflowDeclaration[EventInput, LowerTaskOutput] { return factory.NewTask( @@ -71,6 +73,7 @@ func LowerWithFilter(hatchet v1.HatchetClient) workflow.WorkflowDeclaration[Even ) } + func Upper(hatchet v1.HatchetClient) workflow.WorkflowDeclaration[EventInput, UpperTaskOutput] { return factory.NewTask( create.StandaloneTask{