| 1 | // Code generated by sqlc. DO NOT EDIT. |
| 2 | // versions: |
| 3 | // sqlc v1.31.1 |
| 4 | |
| 5 | package webhookdb |
| 6 | |
| 7 | import ( |
| 8 | "context" |
| 9 | |
| 10 | "github.com/jackc/pgx/v5/pgtype" |
| 11 | ) |
| 12 | |
| 13 | type Querier interface { |
| 14 | AutoDisableWebhook(ctx context.Context, db DBTX, arg AutoDisableWebhookParams) error |
| 15 | // Hot-path for the deliver worker: picks up to $1 rows that are |
| 16 | // pending or in retry-ready state, FOR UPDATE SKIP LOCKED so concurrent |
| 17 | // workers don't double-send. The deliverer marks the row 'pending' |
| 18 | // with a far-future next_retry_at while it works on it (defense |
| 19 | // against re-claim during a long HTTP timeout). |
| 20 | ClaimDueDeliveries(ctx context.Context, db DBTX, limit int32) ([]int64, error) |
| 21 | CreateDelivery(ctx context.Context, db DBTX, arg CreateDeliveryParams) (WebhookDelivery, error) |
| 22 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 23 | // |
| 24 | // Query surface for the webhook package. Naming mirrors the verb the |
| 25 | // caller uses; visibility / ownership filters are applied by the |
| 26 | // handler layer (the queries are deliberately narrow on key columns). |
| 27 | CreateWebhook(ctx context.Context, db DBTX, arg CreateWebhookParams) (Webhook, error) |
| 28 | DeleteWebhook(ctx context.Context, db DBTX, id int64) error |
| 29 | GetDeliveryByID(ctx context.Context, db DBTX, id int64) (WebhookDelivery, error) |
| 30 | // Resolve a repo's owner so the fanout knows which webhooks to fire. |
| 31 | // Returns owner_kind 'user' or 'org' so the matcher knows what bucket |
| 32 | // to look in. (We use 'user' as a literal string here; the webhook |
| 33 | // machinery itself only stores 'repo'/'org' as owners — repo-owned |
| 34 | // webhooks attach to the repo regardless of who owns the repo.) |
| 35 | GetRepoOwnerKindForFanout(ctx context.Context, db DBTX, id int64) (GetRepoOwnerKindForFanoutRow, error) |
| 36 | GetWebhookByID(ctx context.Context, db DBTX, id int64) (Webhook, error) |
| 37 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 38 | // |
| 39 | // Webhook fanout reads the same domain_events / cursor surface that |
| 40 | // notifications do — but with its own consumer row so progress |
| 41 | // doesn't collide with notify_fanout. |
| 42 | GetWebhookCursor(ctx context.Context, db DBTX, consumer string) (DomainEventsProcessed, error) |
| 43 | // Used by fanout to find subscribers for an event. |
| 44 | ListActiveWebhooksForOwner(ctx context.Context, db DBTX, arg ListActiveWebhooksForOwnerParams) ([]Webhook, error) |
| 45 | ListDeliveriesForWebhook(ctx context.Context, db DBTX, arg ListDeliveriesForWebhookParams) ([]ListDeliveriesForWebhookRow, error) |
| 46 | ListUnprocessedDomainEvents(ctx context.Context, db DBTX, arg ListUnprocessedDomainEventsParams) ([]DomainEvent, error) |
| 47 | ListWebhooksForOwner(ctx context.Context, db DBTX, arg ListWebhooksForOwnerParams) ([]Webhook, error) |
| 48 | MarkDeliveryPermanentFailure(ctx context.Context, db DBTX, arg MarkDeliveryPermanentFailureParams) error |
| 49 | MarkDeliveryRetry(ctx context.Context, db DBTX, arg MarkDeliveryRetryParams) error |
| 50 | MarkDeliverySucceeded(ctx context.Context, db DBTX, arg MarkDeliverySucceededParams) error |
| 51 | // Cron: drops terminal deliveries older than the retention window. |
| 52 | // pending/failed_retry rows are left alone so an in-flight retry isn't |
| 53 | // aborted out from under the worker. |
| 54 | PurgeOldDeliveries(ctx context.Context, db DBTX, retention pgtype.Interval) (int64, error) |
| 55 | // Increments the failure counter and reports the new value so the |
| 56 | // caller can decide whether to auto-disable. |
| 57 | RecordWebhookFailure(ctx context.Context, db DBTX, id int64) (RecordWebhookFailureRow, error) |
| 58 | RecordWebhookSuccess(ctx context.Context, db DBTX, id int64) error |
| 59 | // Re-enables a previously auto-disabled webhook (UI affordance). |
| 60 | // Resets the failure counter and clears disabled_at/reason. |
| 61 | SetWebhookActive(ctx context.Context, db DBTX, arg SetWebhookActiveParams) error |
| 62 | SetWebhookCursor(ctx context.Context, db DBTX, arg SetWebhookCursorParams) error |
| 63 | UpdateWebhook(ctx context.Context, db DBTX, arg UpdateWebhookParams) error |
| 64 | UpdateWebhookSecret(ctx context.Context, db DBTX, arg UpdateWebhookSecretParams) error |
| 65 | } |
| 66 | |
| 67 | var _ Querier = (*Queries)(nil) |
| 68 |