MCPcopy Create free account
hub / github.com/bytebase/bytebase / BatchCancelPlanCheckRuns

Method BatchCancelPlanCheckRuns

backend/store/plan_check_run.go:211–226  ·  view source on GitHub ↗

BatchCancelPlanCheckRuns updates the status of planCheckRuns to CANCELED.

(ctx context.Context, projectID string, planCheckRunUIDs []int64)

Source from the content-addressed store, hash-verified

209
210// BatchCancelPlanCheckRuns updates the status of planCheckRuns to CANCELED.
211func (s *Store) BatchCancelPlanCheckRuns(ctx context.Context, projectID string, planCheckRunUIDs []int64) error {
212 q := qb.Q().Space(`
213 UPDATE plan_check_run
214 SET
215 status = ?,
216 updated_at = ?
217 WHERE id = ANY(?) AND project = ?`, PlanCheckRunStatusCanceled, time.Now(), planCheckRunUIDs, projectID)
218 query, args, err := q.ToSQL()
219 if err != nil {
220 return errors.Wrapf(err, "failed to build sql")
221 }
222 if _, err := s.GetDB().ExecContext(ctx, query, args...); err != nil {
223 return err
224 }
225 return nil
226}
227
228// ClaimedPlanCheckRun represents a plan check run that was atomically claimed.
229type ClaimedPlanCheckRun struct {

Callers 1

CancelPlanCheckRunMethod · 0.80

Calls 4

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

Tested by

no test coverage detected