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

Method UpdateTaskRunStartAt

backend/store/task_run.go:273–297  ·  view source on GitHub ↗
(ctx context.Context, projectID string, taskRunID int64)

Source from the content-addressed store, hash-verified

271}
272
273func (s *Store) UpdateTaskRunStartAt(ctx context.Context, projectID string, taskRunID int64) error {
274 q := qb.Q().Space(`
275 UPDATE task_run
276 SET started_at = now(), updated_at = now()
277 WHERE id = ? AND project = ?
278 `, taskRunID, projectID)
279
280 query, args, err := q.ToSQL()
281 if err != nil {
282 return errors.Wrapf(err, "failed to build sql")
283 }
284
285 result, err := s.GetDB().ExecContext(ctx, query, args...)
286 if err != nil {
287 return errors.Wrapf(err, "failed to update task run start at")
288 }
289 rowsAffected, err := result.RowsAffected()
290 if err != nil {
291 return errors.Wrapf(err, "failed to get affected task run count")
292 }
293 if rowsAffected == 0 {
294 return errors.Errorf("task run %d not found in project %s", taskRunID, projectID)
295 }
296 return nil
297}
298
299// CreatePendingTaskRuns creates pending task runs.
300// This operation is idempotent and safe for concurrent calls:

Callers 1

executeTaskRunMethod · 0.80

Calls 5

GetDBMethod · 0.95
QFunction · 0.92
SpaceMethod · 0.80
ToSQLMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected