Go · 6467 bytes Raw Blame History
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 // Used by hard-delete: drop the redirect rows pointing at this repo
27 // (they would dangle once the repos row is gone; the FK ON DELETE
28 // CASCADE would handle it, but explicit is auditable).
29 DeleteRedirectsForRepo(ctx context.Context, db DBTX, repoID int64) error
30 ExistsRepoForOwnerUser(ctx context.Context, db DBTX, arg ExistsRepoForOwnerUserParams) (bool, error)
31 // Called by the periodic worker (transfers:expire) — flips pending
32 // offers past their expires_at to the expired terminal state.
33 ExpirePendingTransfers(ctx context.Context, db DBTX) (int64, error)
34 GetRepoByID(ctx context.Context, db DBTX, id int64) (Repo, error)
35 GetRepoByOwnerUserAndName(ctx context.Context, db DBTX, arg GetRepoByOwnerUserAndNameParams) (Repo, error)
36 // Returns the owner_username for a repo. Used by size-recalc and other
37 // jobs that need to derive the bare-repo on-disk path without round-
38 // tripping through the full user row.
39 GetRepoOwnerUsernameByID(ctx context.Context, db DBTX, id int64) (GetRepoOwnerUsernameByIDRow, error)
40 GetTransferRequest(ctx context.Context, db DBTX, id int64) (RepoTransferRequest, error)
41 HardDeleteRepo(ctx context.Context, db DBTX, id int64) error
42 // ─── redirects ─────────────────────────────────────────────────────────
43 // Both old-owner FKs are nullable; pass exactly one. The CHECK
44 // constraint on the table enforces the xor shape.
45 InsertRepoRedirect(ctx context.Context, db DBTX, arg InsertRepoRedirectParams) error
46 // ─── transfer requests ─────────────────────────────────────────────────
47 InsertTransferRequest(ctx context.Context, db DBTX, arg InsertTransferRequestParams) (RepoTransferRequest, error)
48 // Used by `shithubd hooks reinstall --all` to enumerate every active
49 // bare repo on disk and re-link its hooks.
50 ListAllRepoFullNames(ctx context.Context, db DBTX) ([]ListAllRepoFullNamesRow, error)
51 // Inbox view: pending offers a user can act on.
52 ListPendingTransfersForUser(ctx context.Context, db DBTX, toPrincipalID int64) ([]RepoTransferRequest, error)
53 // ─── soft-delete sweep query ───────────────────────────────────────────
54 // The repo:hard_delete enqueuer queries this to find rows ready for
55 // destruction. The 7-day grace is hard-coded here; if we add a config
56 // knob later, change this to a parameter.
57 ListRepoIDsPastSoftDeleteGrace(ctx context.Context, db DBTX) ([]int64, error)
58 ListReposForOwnerUser(ctx context.Context, db DBTX, ownerUserID pgtype.Int8) ([]Repo, error)
59 // /settings/repositories/restore page lists these.
60 ListSoftDeletedReposForOwner(ctx context.Context, db DBTX, ownerUserID pgtype.Int8) ([]ListSoftDeletedReposForOwnerRow, error)
61 // Sender / repo-settings view.
62 ListTransfersForRepo(ctx context.Context, db DBTX, repoID int64) ([]RepoTransferRequest, error)
63 // Returns the current repo_id when (old_owner_user_id, old_name) hits
64 // a redirect row.
65 LookupRedirectByUserOwner(ctx context.Context, db DBTX, arg LookupRedirectByUserOwnerParams) (int64, error)
66 // ─── fork-anchor cleanup on hard delete ────────────────────────────────
67 // Children pointing at this repo lose their fork-of pointer. Mirrors
68 // GitHub's behavior when an upstream is deleted.
69 OrphanForksOf(ctx context.Context, db DBTX, forkOfRepoID pgtype.Int8) (int64, error)
70 // SPDX-License-Identifier: AGPL-3.0-or-later
71 //
72 // S16 lifecycle queries. Kept in a separate file from repos.sql so the
73 // mainline CRUD stays easy to read.
74 // ─── repo mutations ────────────────────────────────────────────────────
75 // Same-owner rename. The handler validates the new name shape and the
76 // redirect row is INSERTed in the same tx.
77 RenameRepo(ctx context.Context, db DBTX, arg RenameRepoParams) error
78 RestoreRepo(ctx context.Context, db DBTX, id int64) error
79 SetRepoVisibility(ctx context.Context, db DBTX, arg SetRepoVisibilityParams) error
80 SoftDeleteRepo(ctx context.Context, db DBTX, id int64) error
81 // Distinct name from S11's SoftDeleteRepo so future code that wants to
82 // preserve the lifecycle audit-emission shape can find this one.
83 SoftDeleteRepoLifecycle(ctx context.Context, db DBTX, id int64) error
84 // Sets owner_user_id (or owner_org_id post-S31) on accept. The xor
85 // check on the table enforces the shape. Also clears the other side
86 // so a user→org transfer flips both columns atomically.
87 TransferRepoOwner(ctx context.Context, db DBTX, arg TransferRepoOwnerParams) error
88 UnarchiveRepo(ctx context.Context, db DBTX, id int64) error
89 // Set when push:process detects a commit on the repo's default branch.
90 // Pass NULL to clear (e.g. when the branch is force-deleted in a future
91 // sprint). The repo home view reads this to decide between empty and
92 // populated layouts.
93 UpdateRepoDefaultBranchOID(ctx context.Context, db DBTX, arg UpdateRepoDefaultBranchOIDParams) error
94 UpdateRepoDiskUsed(ctx context.Context, db DBTX, arg UpdateRepoDiskUsedParams) error
95 }
96
97 var _ Querier = (*Queries)(nil)
98