Files
uptimesebi/internal/store/querier.go
T
Sebastian UnterschützandClaude Opus 5.5 f3d402705e
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m0s
ci / test (pull_request) Successful in 12m1s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Successful in 5m9s
feat: support tickets between accounts and platform admins
Accounts open tickets under Support and admins answer them under Admin →
Support tickets.

- A ticket is open while it waits for the admins and answered while it
  waits for the account. Either side can close or reopen it, and a reply
  reopens it.
- The admins are mailed about new tickets and replies, and the account
  about answers.
- A ticket can name the active organization and point at a monitor,
  notification channel, alert group, status page or incident in it.
  Each must be something the account can read.
- Next to the conversation, admins see the account at a glance: state,
  sign-in, organizations with their limits and usage, and open tickets.
- Admins switch support off and limit how many tickets an account has
  open at once.
- Suspended accounts and those yet to accept the terms reach support too;
  a suspended account opens one ticket.
- Tickets are part of the account export and are deleted with the
  account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-24 18:01:50 +01:00

411 lines
29 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package store
import (
"context"
"time"
"github.com/google/uuid"
)
type Querier interface {
APITokenOrg(ctx context.Context, hash []byte) (uuid.UUID, error)
AcceptLegal(ctx context.Context, arg AcceptLegalParams) error
AcceptedLegalVersions(ctx context.Context, userID uuid.UUID) ([]AcceptedLegalVersionsRow, error)
AddAlertGroupChannel(ctx context.Context, arg AddAlertGroupChannelParams) (int64, error)
AddIncidentUpdate(ctx context.Context, arg AddIncidentUpdateParams) (IncidentUpdate, error)
AddMaintenanceTarget(ctx context.Context, arg AddMaintenanceTargetParams) error
AddMembership(ctx context.Context, arg AddMembershipParams) error
AddMonitorAlertGroup(ctx context.Context, arg AddMonitorAlertGroupParams) (int64, error)
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
AddSupportMessage(ctx context.Context, arg AddSupportMessageParams) (SupportMessage, error)
AdminEmails(ctx context.Context) ([]string, error)
// System scope: organizations with their usage, limit overrides and owner,
// matching search in name, slug or owner email; newest first, a page from a
// keyset cursor.
AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([]AdminListOrgsRow, error)
// System scope: public status pages and suspended ones, with their
// organization and its owner, matching search in title, slug, domain,
// organization or owner email; newest first, a page from a keyset cursor.
AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error)
AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error)
// System scope: enabled alertmanager monitors of org, with when they last
// recorded a result.
AlertmanagerMonitors(ctx context.Context, orgID *uuid.UUID) ([]AlertmanagerMonitorsRow, error)
// System scope: the receiver a webhook token belongs to.
AlertmanagerReceiverByHash(ctx context.Context, tokenHash []byte) (AlertmanagerReceiverByHashRow, error)
AllMonitorAlertGroups(ctx context.Context) ([]MonitorAlertGroup, error)
AllMonitorRegions(ctx context.Context) ([]AllMonitorRegionsRow, error)
AnyUserExists(ctx context.Context) (bool, error)
// How much one instance checked for the organization in the last hour.
CheckerStats(ctx context.Context, arg CheckerStatsParams) (CheckerStatsRow, error)
// System scope. Leases due rows for five minutes so a crashed sender's rows
// come back; SKIP LOCKED lets every API replica work the outbox.
ClaimNotifications(ctx context.Context, max int32) ([]uuid.UUID, error)
// Shortens tokens that would outlive a newly set maximum lifetime.
ClampAPITokenExpiry(ctx context.Context, arg ClampAPITokenExpiryParams) (int64, error)
ClearMaintenanceTargets(ctx context.Context, windowID uuid.UUID) error
ClearStatusPageGroups(ctx context.Context, pageID uuid.UUID) error
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
CountMonitors(ctx context.Context, orgID uuid.UUID) (int64, error)
CountOpenSupportTickets(ctx context.Context, userID uuid.UUID) (int64, error)
CountOwnedOrgs(ctx context.Context, userID uuid.UUID) (int64, error)
CountOwners(ctx context.Context, orgID uuid.UUID) (int64, error)
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
CountStatusPages(ctx context.Context, orgID uuid.UUID) (int64, error)
CountSupportTicketsSince(ctx context.Context, arg CountSupportTicketsSinceParams) (int64, error)
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
// Ways the account can sign in besides platform identities.
CountUserSignIns(ctx context.Context, id uuid.UUID) (int32, error)
CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)
CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent, error)
CreateAlertGroup(ctx context.Context, arg CreateAlertGroupParams) (AlertGroup, error)
CreateAlertmanagerReceiver(ctx context.Context, arg CreateAlertmanagerReceiverParams) (CreateAlertmanagerReceiverRow, error)
CreateAssignment(ctx context.Context, arg CreateAssignmentParams) (RoleAssignment, error)
CreateChannel(ctx context.Context, arg CreateChannelParams) (NotificationChannel, error)
CreateGroup(ctx context.Context, arg CreateGroupParams) (MonitorGroup, error)
CreateIdentity(ctx context.Context, arg CreateIdentityParams) error
CreateIncidentStatus(ctx context.Context, arg CreateIncidentStatusParams) (IncidentStatus, error)
CreateInvitation(ctx context.Context, arg CreateInvitationParams) (Invitation, error)
CreateMaintenance(ctx context.Context, arg CreateMaintenanceParams) (MaintenanceWindow, error)
CreateMonitor(ctx context.Context, arg CreateMonitorParams) (Monitor, error)
CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, error)
CreatePlatformIDP(ctx context.Context, arg CreatePlatformIDPParams) (PlatformIdentityProvider, error)
CreatePlatformIdentity(ctx context.Context, arg CreatePlatformIdentityParams) error
CreateRegion(ctx context.Context, arg CreateRegionParams) (Region, error)
CreateRole(ctx context.Context, arg CreateRoleParams) (Role, error)
CreateSSOProvider(ctx context.Context, arg CreateSSOProviderParams) (SsoProvider, error)
CreateStatusPage(ctx context.Context, arg CreateStatusPageParams) (StatusPage, error)
CreateStatusPageGroup(ctx context.Context, arg CreateStatusPageGroupParams) (StatusPageGroup, error)
CreateSupportTicket(ctx context.Context, arg CreateSupportTicketParams) (SupportTicket, error)
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
DailyBuckets(ctx context.Context, arg DailyBucketsParams) ([]DailyBucketsRow, error)
DailyBucketsForMonitors(ctx context.Context, arg DailyBucketsForMonitorsParams) ([]DailyBucketsForMonitorsRow, error)
DeleteAPIToken(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAccountAudit(ctx context.Context, actorUserID *uuid.UUID) error
DeleteAgent(ctx context.Context, arg DeleteAgentParams) (int64, error)
DeleteAlertGroup(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAlertGroupChannels(ctx context.Context, groupID uuid.UUID) error
DeleteAlertmanagerReceiver(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAssignment(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAssignmentsForResource(ctx context.Context, arg DeleteAssignmentsForResourceParams) error
DeleteChannel(ctx context.Context, id uuid.UUID) (int64, error)
DeleteGroup(ctx context.Context, id uuid.UUID) (int64, error)
DeleteIncidentStatus(ctx context.Context, id uuid.UUID) (int64, error)
DeleteIncidentUpdate(ctx context.Context, arg DeleteIncidentUpdateParams) (int64, error)
DeleteInvitation(ctx context.Context, id uuid.UUID) (int64, error)
DeleteInvitationsForEmail(ctx context.Context, email string) error
DeleteLegalDocument(ctx context.Context, arg DeleteLegalDocumentParams) error
DeleteMaintenance(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitor(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) error
DeleteMonitorRegions(ctx context.Context, monitorID uuid.UUID) error
DeleteOrg(ctx context.Context, id uuid.UUID) (int64, error)
DeleteOrgStorage(ctx context.Context, orgID uuid.UUID) error
DeletePlatformIDP(ctx context.Context, id uuid.UUID) (int64, error)
DeletePlatformIdentity(ctx context.Context, arg DeletePlatformIdentityParams) (int64, error)
DeleteRecoveryCodes(ctx context.Context, userID uuid.UUID) error
DeleteRegion(ctx context.Context, id uuid.UUID) (int64, error)
DeleteRole(ctx context.Context, id uuid.UUID) (int64, error)
DeleteSSOProvider(ctx context.Context, id uuid.UUID) (int64, error)
DeleteStatusPage(ctx context.Context, id uuid.UUID) (int64, error)
DeleteStatusPageGroup(ctx context.Context, arg DeleteStatusPageGroupParams) (int64, error)
// Only the latest success per monitor and region is kept.
DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEvidenceParams) error
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
DisableTOTP(ctx context.Context, id uuid.UUID) error
EmailKeyTaken(ctx context.Context, emailKey *string) (bool, error)
EnableTOTP(ctx context.Context, arg EnableTOTPParams) error
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
// An empty name names a new region after its key and keeps an existing name.
EnsurePlatformRegion(ctx context.Context, arg EnsurePlatformRegionParams) (Region, error)
// Evidence of a monitor in a time span, to link results to it.
EvidenceBetween(ctx context.Context, arg EvidenceBetweenParams) ([]EvidenceBetweenRow, error)
// System scope: resolves a request to a page by verified custom domain or
// by slug.
FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error)
// Alerts of org that fire and were repeated within the stale period.
FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]FiringAlertsRow, error)
// FiringAlerts newest first, a page from a keyset cursor (see paging.go)
// whose string key is the fingerprint.
FiringAlertsPage(ctx context.Context, arg FiringAlertsPageParams) ([]FiringAlertsPageRow, error)
// When each monitor and region first reported, to the day.
FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error)
// When each monitor and region first reported since $2, exactly. Used for
// data younger than the daily aggregate's resolution.
FirstDataRecent(ctx context.Context, arg FirstDataRecentParams) ([]FirstDataRecentRow, error)
// Keeps organization and platform entries readable as "deleted user" but
// drops who it was.
ForgetAuditActor(ctx context.Context, actorUserID *uuid.UUID) error
GetAPIToken(ctx context.Context, id uuid.UUID) (ApiToken, error)
GetAPITokenByHash(ctx context.Context, tokenHash []byte) (ApiToken, error)
// System scope.
GetAgentByHash(ctx context.Context, tokenHash []byte) (GetAgentByHashRow, error)
GetAssignment(ctx context.Context, id uuid.UUID) (RoleAssignment, error)
GetChannel(ctx context.Context, id uuid.UUID) (NotificationChannel, error)
GetEvidence(ctx context.Context, arg GetEvidenceParams) (CheckEvidence, error)
GetGroup(ctx context.Context, id uuid.UUID) (MonitorGroup, error)
GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error)
GetIncident(ctx context.Context, id uuid.UUID) (GetIncidentRow, error)
GetInvitation(ctx context.Context, id uuid.UUID) (Invitation, error)
GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error)
GetMaintenance(ctx context.Context, id uuid.UUID) (MaintenanceWindow, error)
GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
GetMonitor(ctx context.Context, id uuid.UUID) (Monitor, error)
GetOrg(ctx context.Context, id uuid.UUID) (Org, error)
GetOrgBySlug(ctx context.Context, slug string) (Org, error)
GetPlatformIDP(ctx context.Context, id uuid.UUID) (PlatformIdentityProvider, error)
GetPlatformIdentity(ctx context.Context, arg GetPlatformIdentityParams) (PlatformIdentity, error)
GetPlatformSetting(ctx context.Context, key string) ([]byte, error)
GetRegion(ctx context.Context, id uuid.UUID) (Region, error)
GetRole(ctx context.Context, id uuid.UUID) (Role, error)
GetSSOProvider(ctx context.Context, id uuid.UUID) (SsoProvider, error)
GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error)
GetSupportTicket(ctx context.Context, id uuid.UUID) (GetSupportTicketRow, error)
GetUser(ctx context.Context, id uuid.UUID) (User, error)
GetUserByEmail(ctx context.Context, email string) (User, error)
// System scope: the monitor a ping token belongs to.
HeartbeatMonitor(ctx context.Context, target string) (HeartbeatMonitorRow, error)
// System scope: enabled heartbeat monitors with their grace period and
// since when they are being waited for: the latest result, or the last
// change of the monitor, which covers new and re-enabled ones. The result
// lookup is bounded because the longest interval plus grace is two days.
HeartbeatsDue(ctx context.Context) ([]HeartbeatsDueRow, error)
// Per monitor and hour since $2, across all regions.
HourlyBuckets(ctx context.Context, arg HourlyBucketsParams) ([]HourlyBucketsRow, error)
IncidentsForMonitors(ctx context.Context, arg IncidentsForMonitorsParams) ([]Incident, error)
// Incidents overlapping the time since $1, for SLA calculation.
IncidentsSince(ctx context.Context, resolvedAt *time.Time) ([]IncidentsSinceRow, error)
InsertAuditEvent(ctx context.Context, arg InsertAuditEventParams) error
// check_results and its aggregates have no row-level security (see
// migration 00013). Every query here must filter by org_id.
InsertCheckResults(ctx context.Context, arg []InsertCheckResultsParams) (int64, error)
InsertEvidence(ctx context.Context, arg InsertEvidenceParams) error
InsertRecoveryCodes(ctx context.Context, arg []InsertRecoveryCodesParams) (int64, error)
InvitationOrg(ctx context.Context, hash []byte) (uuid.UUID, error)
IsMember(ctx context.Context, arg IsMemberParams) (bool, error)
LastFailureEvidence(ctx context.Context, arg LastFailureEvidenceParams) (LastFailureEvidenceRow, error)
LatestResultForMonitor(ctx context.Context, arg LatestResultForMonitorParams) (LatestResultForMonitorRow, error)
// Newest result per monitor and region in the org.
LatestResults(ctx context.Context, orgID uuid.UUID) ([]LatestResultsRow, error)
LatestResultsForMonitor(ctx context.Context, arg LatestResultsForMonitorParams) ([]LatestResultsForMonitorRow, error)
LegalAcceptances(ctx context.Context, userID uuid.UUID) ([]LegalAcceptancesRow, error)
// The organization's documents and the platform's, organization first.
LegalDocuments(ctx context.Context, orgID *uuid.UUID) ([]LegalDocument, error)
ListAPITokens(ctx context.Context, arg ListAPITokensParams) ([]ListAPITokensRow, error)
// Agents owned by org, or platform agents when org is NULL.
ListAgents(ctx context.Context, orgID *uuid.UUID) ([]ListAgentsRow, error)
ListAlertGroups(ctx context.Context) ([]ListAlertGroupsRow, error)
ListAlertmanagerReceivers(ctx context.Context) ([]ListAlertmanagerReceiversRow, error)
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
// Newest first, a page from a keyset cursor (see paging.go). kind narrows
// to one kind; the row policy already limits what the scope can see.
ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error)
ListChannels(ctx context.Context) ([]NotificationChannel, error)
// System scope: every enabled monitor with its regions, for reconciling the
// schedule.
ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error)
ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, error)
// Newest first, a page from a keyset cursor (see paging.go).
ListEvidence(ctx context.Context, arg ListEvidenceParams) ([]ListEvidenceRow, error)
ListGroups(ctx context.Context) ([]MonitorGroup, error)
ListIncidentStatuses(ctx context.Context) ([]IncidentStatus, error)
// Newest first, with the author's name.
ListIncidentUpdates(ctx context.Context, incidentID uuid.UUID) ([]ListIncidentUpdatesRow, error)
// Newest first, a page from a keyset cursor (see paging.go); optionally of
// one monitor.
ListIncidents(ctx context.Context, arg ListIncidentsParams) ([]ListIncidentsRow, error)
ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error)
// Latest start first, a page from a keyset cursor (see paging.go).
ListMaintenancePage(ctx context.Context, arg ListMaintenancePageParams) ([]MaintenanceWindow, error)
ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error)
ListMonitors(ctx context.Context) ([]Monitor, error)
// By name, a page from a keyset cursor (see paging.go).
ListMonitorsPage(ctx context.Context, arg ListMonitorsPageParams) ([]Monitor, error)
ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error)
// By email, a page from a keyset cursor (see paging.go).
ListOrgMembersPage(ctx context.Context, arg ListOrgMembersPageParams) ([]ListOrgMembersPageRow, error)
ListOrgs(ctx context.Context) ([]Org, error)
ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error)
ListPlatformIDPs(ctx context.Context) ([]PlatformIdentityProvider, error)
ListPlatformRegions(ctx context.Context) ([]Region, error)
// A monitor's results newest first, a page from a keyset cursor (see
// paging.go) whose string key is region and checker.
ListResults(ctx context.Context, arg ListResultsParams) ([]ListResultsRow, error)
ListRoles(ctx context.Context) ([]Role, error)
ListSSOProviders(ctx context.Context) ([]SsoProvider, error)
ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([]StatusPageGroup, error)
ListStatusPages(ctx context.Context) ([]StatusPage, error)
// Every account's tickets for the admins, those waiting for them first.
ListSupportTickets(ctx context.Context, status *string) ([]ListSupportTicketsRow, error)
ListUserIdentitiesInOrg(ctx context.Context, userID uuid.UUID) ([]ListUserIdentitiesInOrgRow, error)
ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUserOrgsRow, error)
ListUserPlatformIdentities(ctx context.Context, userID uuid.UUID) ([]ListUserPlatformIdentitiesRow, error)
// The tickets row-level security lets the account see, newest activity
// first.
ListUserSupportTickets(ctx context.Context, userID uuid.UUID) ([]SupportTicket, error)
// Row-level security limits this to platform regions and the scope's org;
// the org's own regions come first.
ListVisibleRegions(ctx context.Context) ([]Region, error)
// Serializes ownership changes of an organization, so two owners stepping
// down at once cannot leave it without one.
LockOrgOwners(ctx context.Context, orgID uuid.UUID) error
// Serializes creations counted against org's limits until the transaction
// ends.
LockOrgUsage(ctx context.Context, orgID uuid.UUID) error
// System scope: windows covering any of the monitors, directly or through
// their group or one of its ancestors.
MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error)
MakeAdmin(ctx context.Context, id uuid.UUID) error
MarkDomainVerified(ctx context.Context, id uuid.UUID) error
MarkEmailVerified(ctx context.Context, id uuid.UUID) (User, error)
MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error)
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
MarkNotificationSent(ctx context.Context, id uuid.UUID) error
// Every role a member holds, with the scope it applies to.
MemberGrants(ctx context.Context, arg MemberGrantsParams) ([]MemberGrantsRow, error)
MonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
MonitorAlertRoutes(ctx context.Context, monitorID uuid.UUID) ([]MonitorAlertRoutesRow, error)
MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
// System scope: monitors to hand to a checker of region, skipping ones that
// were disabled, deleted or moved out of the region since dispatch. An
// org-owned checker only ever sees its org's monitors.
MonitorsForJobs(ctx context.Context, arg MonitorsForJobsParams) ([]Monitor, error)
// System scope: monitors a checker of region may report, with every region
// they are assigned to, for evaluation.
MonitorsForResults(ctx context.Context, arg MonitorsForResultsParams) ([]MonitorsForResultsRow, error)
// System scope.
NotificationDetails(ctx context.Context, ids []uuid.UUID) ([]NotificationDetailsRow, error)
OpenIncident(ctx context.Context, arg OpenIncidentParams) (Incident, error)
OpenIncidents(ctx context.Context) ([]Incident, error)
OrgAssignmentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgAssignmentsExportRow, error)
OrgAuditExport(ctx context.Context, orgID uuid.UUID) ([]OrgAuditExportRow, error)
OrgDailyStats(ctx context.Context, orgID uuid.UUID) ([]OrgDailyStatsRow, error)
OrgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error)
OrgIncidentUpdatesExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentUpdatesExportRow, error)
OrgIncidentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentsExportRow, error)
OrgMembersExport(ctx context.Context, orgID uuid.UUID) ([]OrgMembersExportRow, error)
// Organizations user owns, with their member and owner counts.
OwnedOrgs(ctx context.Context, userID uuid.UUID) ([]OwnedOrgsRow, error)
// The public updates of incidents shown on a status page, newest first.
PublicIncidentUpdates(ctx context.Context, ids []uuid.UUID) ([]PublicIncidentUpdatesRow, error)
// Resolved and long silent alerts are history the monitors' results keep.
PurgeAlertmanagerAlerts(ctx context.Context, updatedAt time.Time) (int64, error)
PurgeAuditEvents(ctx context.Context, argTime time.Time) (int64, error)
PurgeEvidence(ctx context.Context, argTime time.Time) (int64, error)
PurgeExpiredTokens(ctx context.Context, expiresAt *time.Time) (int64, error)
// Incidents resolved before the oldest data still charted.
PurgeIncidents(ctx context.Context, resolvedAt *time.Time) (int64, error)
PurgeInvitations(ctx context.Context, expiresAt time.Time) (int64, error)
// Delivered and given-up notifications; pending ones are still being worked.
PurgeNotifications(ctx context.Context, createdAt time.Time) (int64, error)
PurgeOrgCheckData(ctx context.Context, org uuid.UUID) error
// Accounts never confirmed; they belong to no organization.
PurgeUnverifiedUsers(ctx context.Context, createdAt time.Time) (int64, error)
// Raw results bucketed by width since a point in time, for short ranges.
RangeBuckets(ctx context.Context, arg RangeBucketsParams) ([]RangeBucketsRow, error)
// The daily aggregate rebucketed by width, for ranges of months.
RangeBucketsDaily(ctx context.Context, arg RangeBucketsDailyParams) ([]RangeBucketsDailyRow, error)
// The hourly aggregate rebucketed by width, for ranges of days.
RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error)
// The incident shows the status of its latest update.
RefreshIncidentStatus(ctx context.Context, id uuid.UUID) error
// One monitor's raw results per region.
RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error)
RegionBucketsDaily(ctx context.Context, arg RegionBucketsDailyParams) ([]RegionBucketsDailyRow, error)
RegionBucketsHourly(ctx context.Context, arg RegionBucketsHourlyParams) ([]RegionBucketsHourlyRow, error)
RegroupMonitors(ctx context.Context, arg RegroupMonitorsParams) error
RemoveMembership(ctx context.Context, arg RemoveMembershipParams) (int64, error)
// Moves the subgroups of a group that is about to be deleted.
ReparentGroups(ctx context.Context, arg ReparentGroupsParams) error
ReparentStatusPageGroupChildren(ctx context.Context, arg ReparentStatusPageGroupChildrenParams) error
ReparentStatusPageGroupMonitors(ctx context.Context, arg ReparentStatusPageGroupMonitorsParams) error
// The platform documents accounts have to accept, in their current version.
RequiredLegalVersions(ctx context.Context) ([]RequiredLegalVersionsRow, error)
ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (Incident, error)
// Heartbeats of an organization wait afresh after its suspension, during
// which pings were refused.
RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error
// The organization's results run by one checker instance, newest first, a
// page from a keyset cursor whose string key is monitor and region.
ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
ScrubAuditEmail(ctx context.Context, email string) error
SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error)
SetIncidentTitle(ctx context.Context, arg SetIncidentTitleParams) (int64, error)
SetOrgDisabledCheckTypes(ctx context.Context, arg SetOrgDisabledCheckTypesParams) error
SetOrgLimits(ctx context.Context, arg SetOrgLimitsParams) (SetOrgLimitsRow, error)
SetOwner(ctx context.Context, arg SetOwnerParams) (int64, error)
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
SetPlatformSetting(ctx context.Context, arg SetPlatformSettingParams) error
// Changing the domain drops a previous verification.
SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error)
SetStatusPageMonitorGroup(ctx context.Context, arg SetStatusPageMonitorGroupParams) error
SetSupportTicketStatus(ctx context.Context, arg SetSupportTicketStatusParams) (int64, error)
SetUserAdmin(ctx context.Context, arg SetUserAdminParams) (int64, error)
SetUserLocale(ctx context.Context, arg SetUserLocaleParams) error
SetUserOrgLimit(ctx context.Context, arg SetUserOrgLimitParams) (SetUserOrgLimitRow, error)
// Other instances of the same agent seen in the last day.
SiblingInstances(ctx context.Context, agentID uuid.UUID) ([]SiblingInstancesRow, error)
// Accounts that can sign in only through this provider.
SoleSignInUsers(ctx context.Context, providerID uuid.UUID) (int64, error)
StatusPageMonitors(ctx context.Context, pageID uuid.UUID) ([]StatusPageMonitorsRow, error)
// Deletes key and, as certmagic expects, everything below it.
StorageDelete(ctx context.Context, arg StorageDeleteParams) (int64, error)
StorageGet(ctx context.Context, arg StorageGetParams) (StorageGetRow, error)
StorageList(ctx context.Context, arg StorageListParams) ([]StorageListRow, error)
StoragePut(ctx context.Context, arg StoragePutParams) error
SupportMessages(ctx context.Context, ticketID uuid.UUID) ([]SupportMessagesRow, error)
SupportOptionsAlertGroups(ctx context.Context, orgID uuid.UUID) ([]SupportOptionsAlertGroupsRow, error)
SupportOptionsChannels(ctx context.Context, orgID uuid.UUID) ([]SupportOptionsChannelsRow, error)
SupportOptionsIncidents(ctx context.Context, orgID uuid.UUID) ([]SupportOptionsIncidentsRow, error)
SupportOptionsMonitors(ctx context.Context, orgID uuid.UUID) ([]SupportOptionsMonitorsRow, error)
SupportOptionsStatusPages(ctx context.Context, orgID uuid.UUID) ([]SupportOptionsStatusPagesRow, error)
// Whether everything a new ticket points at belongs to org; run in the
// organization's scope so only what the account may see counts.
SupportReferencesExist(ctx context.Context, arg SupportReferencesExistParams) (*bool, error)
// The names of what a ticket points at, for showing it.
SupportTicketReferences(ctx context.Context, id uuid.UUID) (SupportTicketReferencesRow, error)
SupportTicketStatus(ctx context.Context, id uuid.UUID) (string, error)
SuspendOrg(ctx context.Context, arg SuspendOrgParams) (SuspendOrgRow, error)
SuspendStatusPage(ctx context.Context, arg SuspendStatusPageParams) (SuspendStatusPageRow, error)
SuspendUser(ctx context.Context, arg SuspendUserParams) (SuspendUserRow, error)
TouchAPIToken(ctx context.Context, id uuid.UUID) error
TouchAgent(ctx context.Context, arg TouchAgentParams) error
// Writes at most once a minute per instance; agents poll far more often.
TouchAgentInstance(ctx context.Context, arg TouchAgentInstanceParams) error
TouchIdentity(ctx context.Context, arg TouchIdentityParams) error
TouchPlatformIdentity(ctx context.Context, arg TouchPlatformIdentityParams) error
UpdateAlertGroup(ctx context.Context, arg UpdateAlertGroupParams) (AlertGroup, error)
UpdateChannel(ctx context.Context, arg UpdateChannelParams) (NotificationChannel, error)
UpdateGroup(ctx context.Context, arg UpdateGroupParams) (MonitorGroup, error)
UpdateIncidentStatus(ctx context.Context, arg UpdateIncidentStatusParams) (int64, error)
UpdateMaintenance(ctx context.Context, arg UpdateMaintenanceParams) (MaintenanceWindow, error)
UpdateMonitor(ctx context.Context, arg UpdateMonitorParams) (Monitor, error)
UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams) (Org, error)
UpdatePlatformIDP(ctx context.Context, arg UpdatePlatformIDPParams) (PlatformIdentityProvider, error)
UpdateRole(ctx context.Context, arg UpdateRoleParams) (Role, error)
UpdateSSOProvider(ctx context.Context, arg UpdateSSOProviderParams) (SsoProvider, error)
UpdateStatusPage(ctx context.Context, arg UpdateStatusPageParams) (StatusPage, error)
UpdateStatusPageGroup(ctx context.Context, arg UpdateStatusPageGroupParams) (StatusPageGroup, error)
UpsertAlertmanagerAlert(ctx context.Context, arg UpsertAlertmanagerAlertParams) error
// A new version starts when the document is created or when the edit asks
// everyone to accept it again.
UpsertLegalDocument(ctx context.Context, arg UpsertLegalDocumentParams) error
// Uptime per monitor from the hourly aggregate, including the not yet
// materialized most recent hours (real-time aggregation).
UptimeSince(ctx context.Context, arg UptimeSinceParams) ([]UptimeSinceRow, error)
UseRecoveryCode(ctx context.Context, arg UseRecoveryCodeParams) (int64, error)
// Everything the user did, in any organization, and their own account log.
UserAuditEvents(ctx context.Context, actorUserID *uuid.UUID) ([]UserAuditEventsRow, error)
UserIdentities(ctx context.Context, userID uuid.UUID) ([]UserIdentitiesRow, error)
UserMemberships(ctx context.Context, userID uuid.UUID) ([]UserMembershipsRow, error)
UserRoleNames(ctx context.Context, userID uuid.UUID) ([]UserRoleNamesRow, error)
UserTokens(ctx context.Context, userID uuid.UUID) ([]UserTokensRow, error)
}
var _ Querier = (*Queries)(nil)