mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 21:29:44 -06:00
chore: regenerate examples (#2291)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
committed by
GitHub
parent
49772f76fd
commit
ba803abdfc
@@ -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)
|
||||
}
|
||||
|
||||
@@ -37,3 +37,4 @@ func main() {
|
||||
|
||||
fmt.Println("\nStreaming completed!")
|
||||
}
|
||||
|
||||
|
||||
@@ -58,3 +58,4 @@ func main() {
|
||||
log.Println("Failed to start server:", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user