| 1 | // Code generated by sqlc. DO NOT EDIT. |
| 2 | // versions: |
| 3 | // sqlc v1.31.1 |
| 4 | |
| 5 | package billingdb |
| 6 | |
| 7 | import ( |
| 8 | "context" |
| 9 | |
| 10 | "github.com/jackc/pgx/v5/pgtype" |
| 11 | ) |
| 12 | |
| 13 | type Querier interface { |
| 14 | ApplySubscriptionSnapshot(ctx context.Context, db DBTX, arg ApplySubscriptionSnapshotParams) (ApplySubscriptionSnapshotRow, error) |
| 15 | // Mirrors ApplySubscriptionSnapshot for orgs minus the seat columns |
| 16 | // and with `user_plan` as the plan enum. The same CTE pattern keeps |
| 17 | // users.plan and user_billing_states.plan atomic. |
| 18 | ApplyUserSubscriptionSnapshot(ctx context.Context, db DBTX, arg ApplyUserSubscriptionSnapshotParams) (ApplyUserSubscriptionSnapshotRow, error) |
| 19 | ClearBillingLock(ctx context.Context, db DBTX, orgID int64) (ClearBillingLockRow, error) |
| 20 | ClearUserBillingLock(ctx context.Context, db DBTX, userID int64) (ClearUserBillingLockRow, error) |
| 21 | CountBillableOrgMembers(ctx context.Context, db DBTX, orgID int64) (int32, error) |
| 22 | CountPendingOrgInvitations(ctx context.Context, db DBTX, orgID int64) (int32, error) |
| 23 | // ─── billing_seat_snapshots ──────────────────────────────────────── |
| 24 | CreateSeatSnapshot(ctx context.Context, db DBTX, arg CreateSeatSnapshotParams) (CreateSeatSnapshotRow, error) |
| 25 | // ─── billing_webhook_events ──────────────────────────────────────── |
| 26 | CreateWebhookEventReceipt(ctx context.Context, db DBTX, arg CreateWebhookEventReceiptParams) (BillingWebhookEvent, error) |
| 27 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 28 | // ─── org_billing_states ──────────────────────────────────────────── |
| 29 | GetOrgBillingState(ctx context.Context, db DBTX, orgID int64) (OrgBillingState, error) |
| 30 | GetOrgBillingStateByStripeCustomer(ctx context.Context, db DBTX, stripeCustomerID pgtype.Text) (OrgBillingState, error) |
| 31 | GetOrgBillingStateByStripeSubscription(ctx context.Context, db DBTX, stripeSubscriptionID pgtype.Text) (OrgBillingState, error) |
| 32 | // ─── user_billing_states (PRO03) ────────────────────────────────── |
| 33 | GetUserBillingState(ctx context.Context, db DBTX, userID int64) (UserBillingState, error) |
| 34 | GetUserBillingStateByStripeCustomer(ctx context.Context, db DBTX, stripeCustomerID pgtype.Text) (UserBillingState, error) |
| 35 | GetUserBillingStateByStripeSubscription(ctx context.Context, db DBTX, stripeSubscriptionID pgtype.Text) (UserBillingState, error) |
| 36 | GetWebhookEventReceipt(ctx context.Context, db DBTX, providerEventID string) (BillingWebhookEvent, error) |
| 37 | // PRO03: filters on the polymorphic subject columns so the index |
| 38 | // billing_invoices_subject_created_idx services this query. The |
| 39 | // legacy `org_id` column is kept populated by UpsertInvoice for the |
| 40 | // transitional window; this query no longer reads it. |
| 41 | ListInvoicesForOrg(ctx context.Context, db DBTX, arg ListInvoicesForOrgParams) ([]BillingInvoice, error) |
| 42 | // Polymorphic invoice listing for PRO04+ callers. The org-flavored |
| 43 | // ListInvoicesForOrg above is the same query with subject_kind |
| 44 | // hard-coded; this surface lets a user-side caller pass kind='user' |
| 45 | // without forking the helper. |
| 46 | ListInvoicesForSubject(ctx context.Context, db DBTX, arg ListInvoicesForSubjectParams) ([]BillingInvoice, error) |
| 47 | ListSeatSnapshotsForOrg(ctx context.Context, db DBTX, arg ListSeatSnapshotsForOrgParams) ([]BillingSeatSnapshot, error) |
| 48 | MarkCanceled(ctx context.Context, db DBTX, arg MarkCanceledParams) (MarkCanceledRow, error) |
| 49 | MarkPastDue(ctx context.Context, db DBTX, arg MarkPastDueParams) (OrgBillingState, error) |
| 50 | MarkPaymentSucceeded(ctx context.Context, db DBTX, arg MarkPaymentSucceededParams) (MarkPaymentSucceededRow, error) |
| 51 | MarkUserCanceled(ctx context.Context, db DBTX, arg MarkUserCanceledParams) (MarkUserCanceledRow, error) |
| 52 | MarkUserPastDue(ctx context.Context, db DBTX, arg MarkUserPastDueParams) (UserBillingState, error) |
| 53 | MarkUserPaymentSucceeded(ctx context.Context, db DBTX, arg MarkUserPaymentSucceededParams) (MarkUserPaymentSucceededRow, error) |
| 54 | MarkWebhookEventFailed(ctx context.Context, db DBTX, arg MarkWebhookEventFailedParams) (BillingWebhookEvent, error) |
| 55 | MarkWebhookEventProcessed(ctx context.Context, db DBTX, providerEventID string) (BillingWebhookEvent, error) |
| 56 | SetStripeCustomer(ctx context.Context, db DBTX, arg SetStripeCustomerParams) (OrgBillingState, error) |
| 57 | SetUserStripeCustomer(ctx context.Context, db DBTX, arg SetUserStripeCustomerParams) (UserBillingState, error) |
| 58 | // ─── billing_invoices ────────────────────────────────────────────── |
| 59 | // PRO03: writes both legacy `org_id` and polymorphic |
| 60 | // `(subject_kind, subject_id)`. Callers continue to bind org_id only; |
| 61 | // the subject columns are derived. After PRO04 migrates all callers |
| 62 | // to the polymorphic shape, a follow-up migration drops `org_id` and |
| 63 | // this query loses the legacy column from its INSERT list. |
| 64 | UpsertInvoice(ctx context.Context, db DBTX, arg UpsertInvoiceParams) (BillingInvoice, error) |
| 65 | } |
| 66 | |
| 67 | var _ Querier = (*Queries)(nil) |
| 68 |