Go · 13856 bytes Raw Blame History
1 // Code generated by sqlc. DO NOT EDIT.
2 // versions:
3 // sqlc v1.31.1
4
5 package actionsdb
6
7 import (
8 "context"
9
10 "github.com/jackc/pgx/v5/pgtype"
11 )
12
13 type Querier interface {
14 // SPDX-License-Identifier: AGPL-3.0-or-later
15 AppendStepLogChunk(ctx context.Context, db DBTX, arg AppendStepLogChunkParams) (AppendStepLogChunkRow, error)
16 ApproveWorkflowRun(ctx context.Context, db DBTX, arg ApproveWorkflowRunParams) (ApproveWorkflowRunRow, error)
17 CancelOpenWorkflowStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]WorkflowStep, error)
18 ClaimQueuedWorkflowJob(ctx context.Context, db DBTX, arg ClaimQueuedWorkflowJobParams) (ClaimQueuedWorkflowJobRow, error)
19 CompleteWorkflowRun(ctx context.Context, db DBTX, arg CompleteWorkflowRunParams) (WorkflowRun, error)
20 CountQueuedWorkflowRunsForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
21 CountRecentWorkflowRunsForActor(ctx context.Context, db DBTX, arg CountRecentWorkflowRunsForActorParams) (int64, error)
22 CountRunningJobsForRunner(ctx context.Context, db DBTX, runnerID int64) (int32, error)
23 CountRunningWorkflowJobsForOwner(ctx context.Context, db DBTX, repoID int64) (int64, error)
24 CountRunningWorkflowJobsForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
25 CountWorkflowCachesForRepo(ctx context.Context, db DBTX, arg CountWorkflowCachesForRepoParams) (int64, error)
26 CountWorkflowRunsForRepo(ctx context.Context, db DBTX, arg CountWorkflowRunsForRepoParams) (int64, error)
27 DeleteOldRunnerJWTUsesForCleanup(ctx context.Context, db DBTX, expiresAt pgtype.Timestamptz) (int64, error)
28 DeleteOldWorkflowRunsForCleanup(ctx context.Context, db DBTX, completedAt pgtype.Timestamptz) (int64, error)
29 DeleteOrgSecret(ctx context.Context, db DBTX, arg DeleteOrgSecretParams) error
30 DeleteOrgVariable(ctx context.Context, db DBTX, arg DeleteOrgVariableParams) error
31 DeleteRepoSecret(ctx context.Context, db DBTX, arg DeleteRepoSecretParams) error
32 DeleteRepoVariable(ctx context.Context, db DBTX, arg DeleteRepoVariableParams) error
33 DeleteStaleStepLogChunksForCleanup(ctx context.Context, db DBTX, completedAt pgtype.Timestamptz) (int64, error)
34 DeleteStepLogChunks(ctx context.Context, db DBTX, stepID int64) error
35 DeleteWorkflowArtifactByID(ctx context.Context, db DBTX, id int64) (int64, error)
36 DeleteWorkflowArtifactsByIDs(ctx context.Context, db DBTX, dollar_1 []int64) (int64, error)
37 DeleteWorkflowCacheByID(ctx context.Context, db DBTX, arg DeleteWorkflowCacheByIDParams) (int64, error)
38 // Returns the deleted rows' object_keys so the handler can purge the
39 // backing tarballs from object storage.
40 DeleteWorkflowCachesByKey(ctx context.Context, db DBTX, arg DeleteWorkflowCachesByKeyParams) ([]string, error)
41 // Cascades to workflow_jobs → workflow_steps → workflow_step_log_chunks
42 // and workflow_artifacts via the on-delete-cascade FK chain. The
43 // S3-side artifact blobs are NOT removed here; the handler queries
44 // the artifact object_keys first and deletes them best-effort after
45 // the row is gone.
46 DeleteWorkflowRunByID(ctx context.Context, db DBTX, id int64) (int64, error)
47 // Idempotent: re-disabling an already-disabled workflow is a no-op
48 // and does not bump disabled_at.
49 DisableWorkflow(ctx context.Context, db DBTX, arg DisableWorkflowParams) error
50 // Returns affected-rows so the handler can distinguish 200 (re-enabled)
51 // from 404-ish no-op.
52 EnableWorkflow(ctx context.Context, db DBTX, arg EnableWorkflowParams) (int64, error)
53 // Idempotent insert: if a row with the same (repo_id, workflow_file,
54 // trigger_event_id) already exists, returns no rows (pgx.ErrNoRows in
55 // Go). The handler treats that as a successful no-op so worker
56 // retries and admin replays of the same triggering event don't
57 // duplicate runs.
58 //
59 // The ON CONFLICT predicate matches the partial unique index defined
60 // in migration 0051; both must agree for postgres to infer the
61 // target.
62 EnqueueWorkflowRun(ctx context.Context, db DBTX, arg EnqueueWorkflowRunParams) (WorkflowRun, error)
63 GetActionsRepoPolicy(ctx context.Context, db DBTX, repoID int64) (ActionsRepoPolicy, error)
64 GetArtifactByID(ctx context.Context, db DBTX, id int64) (WorkflowArtifact, error)
65 // SPDX-License-Identifier: AGPL-3.0-or-later
66 GetEffectiveActionsPolicyForRepo(ctx context.Context, db DBTX, id int64) (GetEffectiveActionsPolicyForRepoRow, error)
67 GetFirstStepForJob(ctx context.Context, db DBTX, jobID int64) (WorkflowStep, error)
68 GetOrgSecret(ctx context.Context, db DBTX, arg GetOrgSecretParams) (GetOrgSecretRow, error)
69 GetOrgVariable(ctx context.Context, db DBTX, arg GetOrgVariableParams) (GetOrgVariableRow, error)
70 GetRepoSecret(ctx context.Context, db DBTX, arg GetRepoSecretParams) (GetRepoSecretRow, error)
71 GetRepoVariable(ctx context.Context, db DBTX, arg GetRepoVariableParams) (GetRepoVariableRow, error)
72 GetRunnerByID(ctx context.Context, db DBTX, id int64) (WorkflowRunner, error)
73 GetRunnerByName(ctx context.Context, db DBTX, name string) (WorkflowRunner, error)
74 GetRunnerByTokenHash(ctx context.Context, db DBTX, tokenHash []byte) (GetRunnerByTokenHashRow, error)
75 GetStepLogChunkBefore(ctx context.Context, db DBTX, arg GetStepLogChunkBeforeParams) (WorkflowStepLogChunk, error)
76 GetStepLogChunkByStepSeq(ctx context.Context, db DBTX, arg GetStepLogChunkByStepSeqParams) (WorkflowStepLogChunk, error)
77 GetWorkflowCacheByID(ctx context.Context, db DBTX, id int64) (WorkflowCache, error)
78 GetWorkflowJobByID(ctx context.Context, db DBTX, id int64) (WorkflowJob, error)
79 GetWorkflowJobSecretMask(ctx context.Context, db DBTX, jobID int64) (WorkflowJobSecretMask, error)
80 GetWorkflowRunApproval(ctx context.Context, db DBTX, runID int64) (WorkflowRunApproval, error)
81 GetWorkflowRunByID(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
82 GetWorkflowRunForRepoByIndex(ctx context.Context, db DBTX, arg GetWorkflowRunForRepoByIndexParams) (GetWorkflowRunForRepoByIndexRow, error)
83 GetWorkflowStepByID(ctx context.Context, db DBTX, id int64) (WorkflowStep, error)
84 HeartbeatRunner(ctx context.Context, db DBTX, arg HeartbeatRunnerParams) (WorkflowRunner, error)
85 // SPDX-License-Identifier: AGPL-3.0-or-later
86 InsertArtifact(ctx context.Context, db DBTX, arg InsertArtifactParams) (WorkflowArtifact, error)
87 // SPDX-License-Identifier: AGPL-3.0-or-later
88 InsertRunner(ctx context.Context, db DBTX, arg InsertRunnerParams) (WorkflowRunner, error)
89 InsertRunnerToken(ctx context.Context, db DBTX, arg InsertRunnerTokenParams) (RunnerToken, error)
90 // SPDX-License-Identifier: AGPL-3.0-or-later
91 // Called by the future runner-side upload handler when an
92 // actions/cache step completes its tarball upload. Idempotent on
93 // (repo_id, cache_key, cache_version, git_ref): a re-upload with the
94 // same coordinates updates size + last_accessed_at + object_key.
95 InsertWorkflowCache(ctx context.Context, db DBTX, arg InsertWorkflowCacheParams) (WorkflowCache, error)
96 // SPDX-License-Identifier: AGPL-3.0-or-later
97 InsertWorkflowJob(ctx context.Context, db DBTX, arg InsertWorkflowJobParams) (WorkflowJob, error)
98 // SPDX-License-Identifier: AGPL-3.0-or-later
99 InsertWorkflowRun(ctx context.Context, db DBTX, arg InsertWorkflowRunParams) (WorkflowRun, error)
100 // SPDX-License-Identifier: AGPL-3.0-or-later
101 InsertWorkflowRunApproval(ctx context.Context, db DBTX, arg InsertWorkflowRunApprovalParams) (WorkflowRunApproval, error)
102 // SPDX-License-Identifier: AGPL-3.0-or-later
103 InsertWorkflowStep(ctx context.Context, db DBTX, arg InsertWorkflowStepParams) (WorkflowStep, error)
104 // SPDX-License-Identifier: AGPL-3.0-or-later
105 // Hot path for trigger.Enqueue: skip enqueueing when the row exists.
106 IsWorkflowDisabled(ctx context.Context, db DBTX, arg IsWorkflowDisabledParams) (bool, error)
107 ListActiveWorkflowRunsForAdmin(ctx context.Context, db DBTX, arg ListActiveWorkflowRunsForAdminParams) ([]WorkflowRun, error)
108 ListAllStepLogChunksForStep(ctx context.Context, db DBTX, stepID int64) ([]WorkflowStepLogChunk, error)
109 // Used by the run-delete REST handler to drive a best-effort S3
110 // cleanup after the workflow_runs row (and its cascaded
111 // workflow_artifacts rows) have been removed.
112 ListArtifactObjectKeysForRun(ctx context.Context, db DBTX, runID int64) ([]string, error)
113 ListArtifactsForRun(ctx context.Context, db DBTX, runID int64) ([]ListArtifactsForRunRow, error)
114 // Older queued/running runs with the same group block the new run while they
115 // still have at least one queued/running job that has not already received a
116 // cancel request. cancel-in-progress releases the slot by flipping that job
117 // flag even if the runner is still draining the old container.
118 ListBlockingConcurrencyRunsForUpdate(ctx context.Context, db DBTX, arg ListBlockingConcurrencyRunsForUpdateParams) ([]WorkflowRun, error)
119 // Used by the workflows-list endpoint to mark `state: "disabled"`
120 // entries without round-tripping through Is for every file.
121 ListDisabledWorkflowsForRepo(ctx context.Context, db DBTX, repoID int64) ([]string, error)
122 ListExpiredWorkflowArtifactsForCleanup(ctx context.Context, db DBTX, arg ListExpiredWorkflowArtifactsForCleanupParams) ([]ListExpiredWorkflowArtifactsForCleanupRow, error)
123 ListJobsForRun(ctx context.Context, db DBTX, runID int64) ([]ListJobsForRunRow, error)
124 ListOrgSecrets(ctx context.Context, db DBTX, orgID pgtype.Int8) ([]ListOrgSecretsRow, error)
125 ListOrgVariables(ctx context.Context, db DBTX, orgID pgtype.Int8) ([]ListOrgVariablesRow, error)
126 ListQueuedWorkflowJobRunsOn(ctx context.Context, db DBTX) ([]ListQueuedWorkflowJobRunsOnRow, error)
127 ListRepoSecrets(ctx context.Context, db DBTX, repoID pgtype.Int8) ([]ListRepoSecretsRow, error)
128 ListRepoVariables(ctx context.Context, db DBTX, repoID pgtype.Int8) ([]ListRepoVariablesRow, error)
129 ListRunnerStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListRunnerStepsForJobRow, error)
130 ListRunners(ctx context.Context, db DBTX) ([]ListRunnersRow, error)
131 ListStepLogChunks(ctx context.Context, db DBTX, arg ListStepLogChunksParams) ([]WorkflowStepLogChunk, error)
132 ListStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListStepsForJobRow, error)
133 // Paginated list filtered optionally by ref + key. NULL params skip
134 // the filter. Sorted by last_accessed_at DESC so an operator sees the
135 // live caches first.
136 ListWorkflowCachesForRepo(ctx context.Context, db DBTX, arg ListWorkflowCachesForRepoParams) ([]WorkflowCache, error)
137 ListWorkflowRunWorkflowsForRepo(ctx context.Context, db DBTX, repoID int64) ([]ListWorkflowRunWorkflowsForRepoRow, error)
138 ListWorkflowRunsForRepo(ctx context.Context, db DBTX, arg ListWorkflowRunsForRepoParams) ([]ListWorkflowRunsForRepoRow, error)
139 LockRunnerByID(ctx context.Context, db DBTX, id int64) (WorkflowRunner, error)
140 // Companion to EnqueueWorkflowRun for the conflict path: when an
141 // INSERT ... ON CONFLICT DO NOTHING returns no rows, the trigger
142 // handler uses this to find the existing row so it can surface a
143 // stable RunID. Matches the partial-unique index from migration 0051.
144 LookupWorkflowRunByTriggerEvent(ctx context.Context, db DBTX, arg LookupWorkflowRunByTriggerEventParams) (WorkflowRun, error)
145 // SPDX-License-Identifier: AGPL-3.0-or-later
146 MarkRunnerJWTUsed(ctx context.Context, db DBTX, arg MarkRunnerJWTUsedParams) (RunnerJwtUsed, error)
147 MarkWorkflowJobsRejected(ctx context.Context, db DBTX, runID int64) ([]WorkflowJob, error)
148 MarkWorkflowRunRejected(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
149 MarkWorkflowRunRunning(ctx context.Context, db DBTX, id int64) error
150 // Atomic next-index emitter: take the max + 1 for this repo. Pairs
151 // with the (repo_id, run_index) UNIQUE so concurrent inserts that
152 // race here will catch a unique-violation and the caller retries.
153 // Cast to bigint so sqlc generates int64 (the column type) rather
154 // than int32 (the type the +1 literal would default to).
155 NextRunIndexForRepo(ctx context.Context, db DBTX, repoID int64) (int64, error)
156 RejectWorkflowRunApproval(ctx context.Context, db DBTX, arg RejectWorkflowRunApprovalParams) (WorkflowRunApproval, error)
157 RequestWorkflowJobCancel(ctx context.Context, db DBTX, id int64) (WorkflowJob, error)
158 RequestWorkflowRunCancel(ctx context.Context, db DBTX, runID int64) ([]WorkflowJob, error)
159 RevokeAllTokensForRunner(ctx context.Context, db DBTX, runnerID int64) error
160 StartWorkflowRun(ctx context.Context, db DBTX, id int64) (WorkflowRun, error)
161 TouchRunnerHeartbeat(ctx context.Context, db DBTX, arg TouchRunnerHeartbeatParams) error
162 // Bumps last_accessed_at on cache hit. Called by the future
163 // restore-side handler.
164 TouchWorkflowCache(ctx context.Context, db DBTX, id int64) error
165 UpdateStepLogChunk(ctx context.Context, db DBTX, arg UpdateStepLogChunkParams) error
166 UpdateWorkflowJobStatus(ctx context.Context, db DBTX, arg UpdateWorkflowJobStatusParams) (WorkflowJob, error)
167 UpdateWorkflowStepLogObject(ctx context.Context, db DBTX, arg UpdateWorkflowStepLogObjectParams) (WorkflowStep, error)
168 UpdateWorkflowStepStatus(ctx context.Context, db DBTX, arg UpdateWorkflowStepStatusParams) (WorkflowStep, error)
169 UpsertActionsRepoPolicy(ctx context.Context, db DBTX, arg UpsertActionsRepoPolicyParams) (ActionsRepoPolicy, error)
170 UpsertOrgSecret(ctx context.Context, db DBTX, arg UpsertOrgSecretParams) (WorkflowSecret, error)
171 UpsertOrgVariable(ctx context.Context, db DBTX, arg UpsertOrgVariableParams) (ActionsVariable, error)
172 // SPDX-License-Identifier: AGPL-3.0-or-later
173 UpsertRepoSecret(ctx context.Context, db DBTX, arg UpsertRepoSecretParams) (WorkflowSecret, error)
174 // SPDX-License-Identifier: AGPL-3.0-or-later
175 UpsertRepoVariable(ctx context.Context, db DBTX, arg UpsertRepoVariableParams) (ActionsVariable, error)
176 // SPDX-License-Identifier: AGPL-3.0-or-later
177 UpsertWorkflowJobSecretMask(ctx context.Context, db DBTX, arg UpsertWorkflowJobSecretMaskParams) error
178 }
179
180 var _ Querier = (*Queries)(nil)
181