GetTaskByID gets a task by ID.
(ctx context.Context, projectID string, id int64)
| 80 | |
| 81 | // GetTaskByID gets a task by ID. |
| 82 | func (s *Store) GetTaskByID(ctx context.Context, projectID string, id int64) (*TaskMessage, error) { |
| 83 | tasks, err := s.ListTasks(ctx, &TaskFind{ProjectID: projectID, ID: &id}) |
| 84 | if err != nil { |
| 85 | return nil, errors.Wrapf(err, "failed to get Task with ID %d", id) |
| 86 | } |
| 87 | if len(tasks) == 0 { |
| 88 | return nil, nil |
| 89 | } else if len(tasks) > 1 { |
| 90 | return nil, errors.Errorf("found %v tasks with id %v", len(tasks), id) |
| 91 | } |
| 92 | return tasks[0], nil |
| 93 | } |
| 94 | |
| 95 | // Get a blocking task in the pipeline. |
| 96 | // A task is blocked by a task with a smaller schema version within the same pipeline. |
no test coverage detected