Files
uptimesebi/internal/store/querier.go

187 lines
12 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)
AddMembership(ctx context.Context, arg AddMembershipParams) error
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
AllMonitorRegions(ctx context.Context) ([]AllMonitorRegionsRow, error)
AnyUserExists(ctx context.Context) (bool, 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)
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)
CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent, 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
CreateInvitation(ctx context.Context, arg CreateInvitationParams) (Invitation, error)
CreateMonitor(ctx context.Context, arg CreateMonitorParams) (Monitor, error)
CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, 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)
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)
DeleteAgent(ctx context.Context, arg DeleteAgentParams) (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)
DeleteInvitation(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitor(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitorRegions(ctx context.Context, monitorID uuid.UUID) error
DeleteOrg(ctx context.Context, id uuid.UUID) (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)
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
DisableTOTP(ctx context.Context, id uuid.UUID) 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)
// System scope: resolves a request to a page by verified custom domain or
// by slug.
FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, 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)
GetGroup(ctx context.Context, id uuid.UUID) (MonitorGroup, error)
GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error)
GetInvitation(ctx context.Context, id uuid.UUID) (Invitation, error)
GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, 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)
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)
GetUser(ctx context.Context, id uuid.UUID) (User, error)
GetUserByEmail(ctx context.Context, email string) (User, 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)
// 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)
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)
// 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)
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)
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
ListChannels(ctx context.Context) ([]NotificationChannel, error)
ListEnabledChannelIDs(ctx context.Context, orgID uuid.UUID) ([]uuid.UUID, 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)
ListGroups(ctx context.Context) ([]MonitorGroup, error)
ListIncidents(ctx context.Context) ([]ListIncidentsRow, error)
ListMonitors(ctx context.Context) ([]Monitor, error)
ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error)
ListOrgs(ctx context.Context) ([]Org, error)
ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error)
ListPlatformRegions(ctx context.Context) ([]Region, error)
ListRoles(ctx context.Context) ([]Role, error)
ListSSOProviders(ctx context.Context) ([]SsoProvider, error)
ListStatusPages(ctx context.Context) ([]StatusPage, error)
ListUserIdentitiesInOrg(ctx context.Context, userID uuid.UUID) ([]ListUserIdentitiesInOrgRow, error)
ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUserOrgsRow, 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)
MakeAdmin(ctx context.Context, id uuid.UUID) error
MarkDomainVerified(ctx context.Context, id uuid.UUID) 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)
MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, 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)
OrgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error)
// Raw results bucketed by width since a point in time, for short ranges.
RangeBuckets(ctx context.Context, arg RangeBucketsParams) ([]RangeBucketsRow, error)
// The hourly aggregate rebucketed by width, for ranges of days.
RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error)
RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, 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
ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (Incident, error)
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
// Changing the domain drops a previous verification.
SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error)
SetUserAdmin(ctx context.Context, arg SetUserAdminParams) (int64, error)
SetUserLocale(ctx context.Context, arg SetUserLocaleParams) 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
TouchAPIToken(ctx context.Context, id uuid.UUID) error
TouchAgent(ctx context.Context, arg TouchAgentParams) error
TouchIdentity(ctx context.Context, arg TouchIdentityParams) error
UpdateChannel(ctx context.Context, arg UpdateChannelParams) (NotificationChannel, error)
UpdateGroup(ctx context.Context, arg UpdateGroupParams) (MonitorGroup, error)
UpdateMonitor(ctx context.Context, arg UpdateMonitorParams) (Monitor, error)
UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams) (Org, 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)
// 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)
}
var _ Querier = (*Queries)(nil)