| 1 | // Code generated by sqlc. DO NOT EDIT. |
| 2 | // versions: |
| 3 | // sqlc v1.31.1 |
| 4 | |
| 5 | package reposdb |
| 6 | |
| 7 | import ( |
| 8 | "context" |
| 9 | |
| 10 | "github.com/jackc/pgx/v5/pgtype" |
| 11 | ) |
| 12 | |
| 13 | type Querier interface { |
| 14 | AcceptTransferRequest(ctx context.Context, db DBTX, id int64) error |
| 15 | ArchiveRepo(ctx context.Context, db DBTX, id int64) error |
| 16 | CancelTransferRequest(ctx context.Context, db DBTX, id int64) error |
| 17 | // ─── rename rate limit support ───────────────────────────────────────── |
| 18 | // Used to enforce the 5-per-30-days rename rate limit. The redirect |
| 19 | // row is the audit trail for renames; counting them per repo gives a |
| 20 | // reliable cap. |
| 21 | CountRecentRedirectsForRepo(ctx context.Context, db DBTX, repoID int64) (int32, error) |
| 22 | CountReposForOwnerUser(ctx context.Context, db DBTX, ownerUserID pgtype.Int8) (int64, error) |
| 23 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 24 | CreateRepo(ctx context.Context, db DBTX, arg CreateRepoParams) (Repo, error) |
| 25 | DeclineTransferRequest(ctx context.Context, db DBTX, id int64) error |
| 26 | DeleteBranchProtectionRule(ctx context.Context, db DBTX, id int64) error |
| 27 | // Used by the rename compensator: drop a single redirect row when |
| 28 | // the rename has to be rolled back due to a filesystem failure. We |
| 29 | // avoided raw SQL here at the audit's request (S00-S25, M). |
| 30 | DeleteRedirectByUserOwnerOldName(ctx context.Context, db DBTX, arg DeleteRedirectByUserOwnerOldNameParams) error |
| 31 | // Used by hard-delete: drop the redirect rows pointing at this repo |
| 32 | // (they would dangle once the repos row is gone; the FK ON DELETE |
| 33 | // CASCADE would handle it, but explicit is auditable). |
| 34 | DeleteRedirectsForRepo(ctx context.Context, db DBTX, repoID int64) error |
| 35 | ExistsRepoForOwnerUser(ctx context.Context, db DBTX, arg ExistsRepoForOwnerUserParams) (bool, error) |
| 36 | // Called by the periodic worker (transfers:expire) — flips pending |
| 37 | // offers past their expires_at to the expired terminal state. |
| 38 | ExpirePendingTransfers(ctx context.Context, db DBTX) (int64, error) |
| 39 | GetBranchProtectionRule(ctx context.Context, db DBTX, id int64) (BranchProtectionRule, error) |
| 40 | GetRepoByID(ctx context.Context, db DBTX, id int64) (Repo, error) |
| 41 | GetRepoByOwnerUserAndName(ctx context.Context, db DBTX, arg GetRepoByOwnerUserAndNameParams) (Repo, error) |
| 42 | // Returns the owner_username for a repo. Used by size-recalc and other |
| 43 | // jobs that need to derive the bare-repo on-disk path without round- |
| 44 | // tripping through the full user row. |
| 45 | GetRepoOwnerUsernameByID(ctx context.Context, db DBTX, id int64) (GetRepoOwnerUsernameByIDRow, error) |
| 46 | GetTransferRequest(ctx context.Context, db DBTX, id int64) (RepoTransferRequest, error) |
| 47 | HardDeleteRepo(ctx context.Context, db DBTX, id int64) error |
| 48 | // ─── redirects ───────────────────────────────────────────────────────── |
| 49 | // Both old-owner FKs are nullable; pass exactly one. The CHECK |
| 50 | // constraint on the table enforces the xor shape. |
| 51 | InsertRepoRedirect(ctx context.Context, db DBTX, arg InsertRepoRedirectParams) error |
| 52 | // ─── transfer requests ───────────────────────────────────────────────── |
| 53 | InsertTransferRequest(ctx context.Context, db DBTX, arg InsertTransferRequestParams) (RepoTransferRequest, error) |
| 54 | // Used by `shithubd hooks reinstall --all` to enumerate every active |
| 55 | // bare repo on disk and re-link its hooks. |
| 56 | ListAllRepoFullNames(ctx context.Context, db DBTX) ([]ListAllRepoFullNamesRow, error) |
| 57 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 58 | ListBranchProtectionRules(ctx context.Context, db DBTX, repoID int64) ([]BranchProtectionRule, error) |
| 59 | // Inbox view: pending offers a user can act on. |
| 60 | ListPendingTransfersForUser(ctx context.Context, db DBTX, toPrincipalID int64) ([]RepoTransferRequest, error) |
| 61 | // ─── soft-delete sweep query ─────────────────────────────────────────── |
| 62 | // The repo:hard_delete enqueuer queries this to find rows ready for |
| 63 | // destruction. The 7-day grace is hard-coded here; if we add a config |
| 64 | // knob later, change this to a parameter. |
| 65 | ListRepoIDsPastSoftDeleteGrace(ctx context.Context, db DBTX) ([]int64, error) |
| 66 | ListReposForOwnerUser(ctx context.Context, db DBTX, ownerUserID pgtype.Int8) ([]Repo, error) |
| 67 | // /settings/repositories/restore page lists these. |
| 68 | ListSoftDeletedReposForOwner(ctx context.Context, db DBTX, ownerUserID pgtype.Int8) ([]ListSoftDeletedReposForOwnerRow, error) |
| 69 | // Sender / repo-settings view. |
| 70 | ListTransfersForRepo(ctx context.Context, db DBTX, repoID int64) ([]RepoTransferRequest, error) |
| 71 | // Returns the current repo_id when (old_owner_user_id, old_name) hits |
| 72 | // a redirect row. |
| 73 | LookupRedirectByUserOwner(ctx context.Context, db DBTX, arg LookupRedirectByUserOwnerParams) (int64, error) |
| 74 | // ─── fork-anchor cleanup on hard delete ──────────────────────────────── |
| 75 | // Children pointing at this repo lose their fork-of pointer. Mirrors |
| 76 | // GitHub's behavior when an upstream is deleted. |
| 77 | OrphanForksOf(ctx context.Context, db DBTX, forkOfRepoID pgtype.Int8) (int64, error) |
| 78 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 79 | // |
| 80 | // S16 lifecycle queries. Kept in a separate file from repos.sql so the |
| 81 | // mainline CRUD stays easy to read. |
| 82 | // ─── repo mutations ──────────────────────────────────────────────────── |
| 83 | // Same-owner rename. The handler validates the new name shape and the |
| 84 | // redirect row is INSERTed in the same tx. |
| 85 | RenameRepo(ctx context.Context, db DBTX, arg RenameRepoParams) error |
| 86 | RestoreRepo(ctx context.Context, db DBTX, id int64) error |
| 87 | SetRepoVisibility(ctx context.Context, db DBTX, arg SetRepoVisibilityParams) error |
| 88 | SoftDeleteRepo(ctx context.Context, db DBTX, id int64) error |
| 89 | // Distinct name from S11's SoftDeleteRepo so future code that wants to |
| 90 | // preserve the lifecycle audit-emission shape can find this one. |
| 91 | SoftDeleteRepoLifecycle(ctx context.Context, db DBTX, id int64) error |
| 92 | // Sets owner_user_id (or owner_org_id post-S31) on accept. The xor |
| 93 | // check on the table enforces the shape. Also clears the other side |
| 94 | // so a user→org transfer flips both columns atomically. |
| 95 | TransferRepoOwner(ctx context.Context, db DBTX, arg TransferRepoOwnerParams) error |
| 96 | UnarchiveRepo(ctx context.Context, db DBTX, id int64) error |
| 97 | // S24 surface for the required-status-check knobs. Branch-protection |
| 98 | // edit handler calls this alongside UpdateBranchProtectionRule. |
| 99 | UpdateBranchProtectionCheckSettings(ctx context.Context, db DBTX, arg UpdateBranchProtectionCheckSettingsParams) error |
| 100 | // S23 surface for the review-related knobs. Branch-protection edit |
| 101 | // handler calls this alongside UpdateBranchProtectionRule. |
| 102 | UpdateBranchProtectionReviewSettings(ctx context.Context, db DBTX, arg UpdateBranchProtectionReviewSettingsParams) error |
| 103 | UpdateBranchProtectionRule(ctx context.Context, db DBTX, arg UpdateBranchProtectionRuleParams) error |
| 104 | // Used by the default-branch settings handler. The on-disk HEAD update |
| 105 | // is a separate step done via `git symbolic-ref` from the orchestrator. |
| 106 | UpdateRepoDefaultBranch(ctx context.Context, db DBTX, arg UpdateRepoDefaultBranchParams) error |
| 107 | // Set when push:process detects a commit on the repo's default branch. |
| 108 | // Pass NULL to clear (e.g. when the branch is force-deleted in a future |
| 109 | // sprint). The repo home view reads this to decide between empty and |
| 110 | // populated layouts. |
| 111 | UpdateRepoDefaultBranchOID(ctx context.Context, db DBTX, arg UpdateRepoDefaultBranchOIDParams) error |
| 112 | UpdateRepoDiskUsed(ctx context.Context, db DBTX, arg UpdateRepoDiskUsedParams) error |
| 113 | UpsertBranchProtectionRule(ctx context.Context, db DBTX, arg UpsertBranchProtectionRuleParams) (int64, error) |
| 114 | } |
| 115 | |
| 116 | var _ Querier = (*Queries)(nil) |
| 117 |