MCPcopy Index your code
hub / github.com/bytebase/bytebase / GetTaskByID

Method GetTaskByID

backend/store/task.go:82–93  ·  view source on GitHub ↗

GetTaskByID gets a task by ID.

(ctx context.Context, projectID string, id int64)

Source from the content-addressed store, hash-verified

80
81// GetTaskByID gets a task by ID.
82func (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.

Callers 2

executeTaskRunMethod · 0.80

Calls 2

ListTasksMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected