| 1 | // Code generated by sqlc. DO NOT EDIT. |
| 2 | // versions: |
| 3 | // sqlc v1.31.1 |
| 4 | |
| 5 | package notifdb |
| 6 | |
| 7 | import ( |
| 8 | "context" |
| 9 | ) |
| 10 | |
| 11 | type Querier interface { |
| 12 | // Per-recipient absolute rate cap: how many total emails to this |
| 13 | // recipient in the last $2 minutes? |
| 14 | CountEmailsForRecipientSince(ctx context.Context, db DBTX, arg CountEmailsForRecipientSinceParams) (int64, error) |
| 15 | // Storm dampener probe: how many emails for this thread did we |
| 16 | // send to this recipient in the last $4 minutes? Caller compares |
| 17 | // to the cap. |
| 18 | CountEmailsForRecipientThreadSince(ctx context.Context, db DBTX, arg CountEmailsForRecipientThreadSinceParams) (int64, error) |
| 19 | CountNotificationsForRecipient(ctx context.Context, db DBTX, arg CountNotificationsForRecipientParams) (int64, error) |
| 20 | CountUnreadForRecipient(ctx context.Context, db DBTX, recipientUserID int64) (int64, error) |
| 21 | DeleteNotificationThread(ctx context.Context, db DBTX, arg DeleteNotificationThreadParams) error |
| 22 | // ─── domain_events_processed ────────────────────────────────────── |
| 23 | GetEventCursor(ctx context.Context, db DBTX, consumer string) (DomainEventsProcessed, error) |
| 24 | GetNotification(ctx context.Context, db DBTX, id int64) (Notification, error) |
| 25 | // ─── notification_threads ────────────────────────────────────────── |
| 26 | GetNotificationThread(ctx context.Context, db DBTX, arg GetNotificationThreadParams) (NotificationThread, error) |
| 27 | // ─── notification_email_log ──────────────────────────────────────── |
| 28 | // Records an email send. Caller decides what to bind for thread_id |
| 29 | // (NULL for thread-less notifications). MessageID is the SMTP / |
| 30 | // transactional-provider message id when available; empty when |
| 31 | // the sender doesn't surface one. |
| 32 | InsertEmailLog(ctx context.Context, db DBTX, arg InsertEmailLogParams) error |
| 33 | // Auto-subscription path: only insert if the user has no explicit |
| 34 | // preference yet. Preserves user choices (e.g. an explicit |
| 35 | // `subscribed=false` from clicking "Unsubscribe"). |
| 36 | InsertNotificationThreadIfAbsent(ctx context.Context, db DBTX, arg InsertNotificationThreadIfAbsentParams) error |
| 37 | // For events with no thread (e.g. repo-admin lifecycle: archived). |
| 38 | // These don't coalesce; each fires its own row. Used sparingly. |
| 39 | InsertThreadlessNotification(ctx context.Context, db DBTX, arg InsertThreadlessNotificationParams) (Notification, error) |
| 40 | // Inbox view, recency-sorted. `onlyUnread` toggles the inbox |
| 41 | // filter ("Unread" tab vs "All"). |
| 42 | ListNotificationsForRecipient(ctx context.Context, db DBTX, arg ListNotificationsForRecipientParams) ([]ListNotificationsForRecipientRow, error) |
| 43 | // Fan-out helper: returns recipients who explicitly subscribed to a |
| 44 | // thread. The fan-out worker unions this with the per-repo `watches` |
| 45 | // result + author/assignee/reviewer rules. |
| 46 | ListSubscribersForThread(ctx context.Context, db DBTX, arg ListSubscribersForThreadParams) ([]ListSubscribersForThreadRow, error) |
| 47 | // The fan-out worker's read cursor. Bounded so a single tick |
| 48 | // doesn't try to drain a million-row backlog. |
| 49 | ListUnprocessedDomainEvents(ctx context.Context, db DBTX, arg ListUnprocessedDomainEventsParams) ([]DomainEvent, error) |
| 50 | // Bounded sweep: a single call doesn't try to update millions of |
| 51 | // rows. Caller paginates via repeated calls when count > batch. |
| 52 | MarkAllReadForRecipient(ctx context.Context, db DBTX, recipientUserID int64) error |
| 53 | // Always-write upsert so the worker doesn't have to special-case |
| 54 | // the missing-row branch (the migration seeds 'notify_fanout' at |
| 55 | // 0; future consumers like 'webhook_deliver' do the same on first |
| 56 | // run via this same call). |
| 57 | SetEventCursor(ctx context.Context, db DBTX, arg SetEventCursorParams) error |
| 58 | SetNotificationRead(ctx context.Context, db DBTX, arg SetNotificationReadParams) error |
| 59 | SetNotificationUnread(ctx context.Context, db DBTX, arg SetNotificationUnreadParams) error |
| 60 | // ─── notifications ───────────────────────────────────────────────── |
| 61 | // Coalesce-or-insert: if a row exists for (recipient, thread), bump |
| 62 | // last_event_at + last_actor + reason and re-flip unread=true so the |
| 63 | // inbox surfaces it again. Otherwise insert a fresh row. |
| 64 | // |
| 65 | // Returns the resulting row (whether it was created or updated) |
| 66 | // so the caller can chain an email-enqueue without a re-read. |
| 67 | UpsertNotificationByThread(ctx context.Context, db DBTX, arg UpsertNotificationByThreadParams) (Notification, error) |
| 68 | // Always-write upsert. Used by Subscribe / Unsubscribe / Ignore |
| 69 | // handlers and by the auto-subscription rules in the fan-out |
| 70 | // worker. |
| 71 | UpsertNotificationThread(ctx context.Context, db DBTX, arg UpsertNotificationThreadParams) error |
| 72 | } |
| 73 | |
| 74 | var _ Querier = (*Queries)(nil) |
| 75 |