(hash, id string, workflowInput map[string]interface{})
| 16 | } |
| 17 | |
| 18 | func (api *API) StartWorkflow(hash, id string, workflowInput map[string]interface{}) error { |
| 19 | // Create a workflow run |
| 20 | workflowRunID, err := uuid.NewRandom() |
| 21 | if err != nil { |
| 22 | return err |
| 23 | } |
| 24 | _, err = api.db.Exec(`INSERT INTO workflow_runs (id, config_hash, workflow_id, started_at) |
| 25 | VALUES ($1, $2, $3, datetime('now'))`, workflowRunID.String(), hash, id) |
| 26 | if err != nil { |
| 27 | return err |
| 28 | } |
| 29 | |
| 30 | workflow, err := api.GetWorkflow(hash, id) |
| 31 | if err != nil { |
| 32 | return err |
| 33 | } |
| 34 | |
| 35 | return api.ScheduleTask(workflowRunID.String(), workflow.Start, workflowInput) |
| 36 | } |
| 37 | |
| 38 | func (api *API) CompleteWorkflowRun(id string, success bool) error { |
| 39 | _, err := api.db.Exec("UPDATE workflow_runs SET completed_at = datetime('now'), success = $1 WHERE id = $2", |
no test coverage detected