Documentation
¶
Index ¶
- type AcceptInvitationRow
- type App
- type AppHook
- type AppLink
- type AppRelease
- type AppReleaseBackfill
- type AppendBuildLogParams
- type Build
- type CancelDeploymentOperationParams
- type ClaimDeploymentOperationParams
- type ClaimDomainsDueForCheckParams
- type ClaimNextDeploymentOperationParams
- type ClaimRecoverableDeploymentOperationParams
- type ClearProjectPositionsParams
- type ClusterJoin
- type CreateAppLinkParams
- type CreateAppParams
- type CreateAppReleaseParams
- type CreateBuildParams
- type CreateCustomDomainParams
- type CreateDeploymentOperationParams
- type CreateDeploymentParams
- type CreateMagicLinkParams
- type CreateProjectParams
- type CreateSessionParams
- type CreateTeamParams
- type CreateTeamRowParams
- type CreateVolumeAndBumpParams
- type CreateVolumeAndBumpRow
- type CreateVolumeParams
- type DBTX
- type DeleteAppHookParams
- type DeleteAppParams
- type DeleteCustomDomainParams
- type DeleteInvitationParams
- type DeleteInvitationsByInviterParams
- type DeleteMembershipParams
- type DeleteOtherSessionsForUserParams
- type DeleteProjectParams
- type DeleteVariableAndBumpParams
- type DeleteVariableAndBumpRow
- type DeleteVariableParams
- type DeleteVolumeAndBumpParams
- type DeleteVolumeAndBumpRow
- type DeleteVolumeParams
- type DeployActivityParams
- type DeployActivityRow
- type Deployment
- type DeploymentOperation
- type Domain
- type FailQueuedBuildOperationParams
- type FinishBuildParams
- type FinishDeploymentOperationParams
- type FinishDeploymentParams
- type GetAppByIDParams
- type GetAppForReleaseBackfillParams
- type GetAppHookParams
- type GetAppParams
- type GetAppReleaseParams
- type GetBuildForDeploymentParams
- type GetBuildParams
- type GetBuildRecoveryOperationParams
- type GetCustomDomainParams
- type GetDeploymentOperationByDeploymentParams
- type GetDeploymentOperationParams
- type GetDeploymentParams
- type GetHookForDeliveryRow
- type GetInvitationByHashRow
- type GetLatestSuccessfulBuildForAppParams
- type GetLiveDeploymentOperationForAppParams
- type GetLiveSessionRow
- type GetMembershipParams
- type GetPasswordByEmailRow
- type GetProjectByIDParams
- type GetProjectBySlugParams
- type GetReleaseBackfillStateParams
- type GetSessionByHashRow
- type GetSuccessfulBuildForImageParams
- type GetVariableParams
- type GetVolumeParams
- type GrowVolumeAndBumpParams
- type GrowVolumeAndBumpRow
- type GrowVolumeParams
- type HasVerifiedDomainsForAppParams
- type IncrementAppConfigVersionParams
- type Invitation
- type ListAdmissiblePushesRow
- type ListAppLinksRow
- type ListAppReleasesParams
- type ListAppsInProjectParams
- type ListAppsWithLastDeployRow
- type ListCustomDomainsForOwnerRow
- type ListCustomDomainsParams
- type ListDeploymentOperationsParams
- type ListDeploymentsParams
- type ListMembersOfTeamRow
- type ListMembershipsForUserRow
- type ListPendingInvitationsRow
- type ListPendingReleaseBackfillsRow
- type ListProjectsRow
- type ListRecentDeploymentsParams
- type ListRecentDeploymentsRow
- type LockPasswordRow
- type MagicLink
- type MarkHookPendingParams
- type MarkVerifiedDomainsRoutedForAppParams
- type Membership
- type MoveAppsWithoutProjectParams
- type PlatformDn
- type PlatformRegistry
- type Project
- type Querier
- type Queries
- func (q *Queries) AcceptInvitation(ctx context.Context, tokenHash []byte) (AcceptInvitationRow, error)
- func (q *Queries) AppendBuildLog(ctx context.Context, arg AppendBuildLogParams) error
- func (q *Queries) CancelDeploymentOperation(ctx context.Context, arg CancelDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) ClaimDeploymentOperation(ctx context.Context, arg ClaimDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) ClaimDomainsDueForCheck(ctx context.Context, arg ClaimDomainsDueForCheckParams) ([]Domain, error)
- func (q *Queries) ClaimNextDeploymentOperation(ctx context.Context, arg ClaimNextDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) ClaimRecoverableDeploymentOperation(ctx context.Context, arg ClaimRecoverableDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) ClearClusterJoin(ctx context.Context) (int64, error)
- func (q *Queries) ClearPlatformRegistry(ctx context.Context) error
- func (q *Queries) ClearProjectPositions(ctx context.Context, arg ClearProjectPositionsParams) (int64, error)
- func (q *Queries) ConsumeMagicLink(ctx context.Context, tokenHash []byte) (User, error)
- func (q *Queries) CountApps(ctx context.Context, ownerID string) (int64, error)
- func (q *Queries) CountOwnersOfTeam(ctx context.Context, ownerID string) (int64, error)
- func (q *Queries) CountPendingReleaseBackfills(ctx context.Context) (int64, error)
- func (q *Queries) CreateApp(ctx context.Context, arg CreateAppParams) (App, error)
- func (q *Queries) CreateAppLink(ctx context.Context, arg CreateAppLinkParams) error
- func (q *Queries) CreateAppRelease(ctx context.Context, arg CreateAppReleaseParams) (AppRelease, error)
- func (q *Queries) CreateBuild(ctx context.Context, arg CreateBuildParams) (Build, error)
- func (q *Queries) CreateCustomDomain(ctx context.Context, arg CreateCustomDomainParams) (Domain, error)
- func (q *Queries) CreateDeployment(ctx context.Context, arg CreateDeploymentParams) (Deployment, error)
- func (q *Queries) CreateDeploymentOperation(ctx context.Context, arg CreateDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) CreateMagicLink(ctx context.Context, arg CreateMagicLinkParams) (MagicLink, error)
- func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
- func (q *Queries) CreateTeam(ctx context.Context, arg CreateTeamParams) (Team, error)
- func (q *Queries) CreateTeamRow(ctx context.Context, arg CreateTeamRowParams) (Team, error)
- func (q *Queries) CreateVolume(ctx context.Context, arg CreateVolumeParams) (Volume, error)
- func (q *Queries) CreateVolumeAndBump(ctx context.Context, arg CreateVolumeAndBumpParams) (CreateVolumeAndBumpRow, error)
- func (q *Queries) DeleteApp(ctx context.Context, arg DeleteAppParams) error
- func (q *Queries) DeleteAppHook(ctx context.Context, arg DeleteAppHookParams) (int64, error)
- func (q *Queries) DeleteCustomDomain(ctx context.Context, arg DeleteCustomDomainParams) (int64, error)
- func (q *Queries) DeleteExpiredInvitations(ctx context.Context) error
- func (q *Queries) DeleteExpiredMagicLinks(ctx context.Context) error
- func (q *Queries) DeleteExpiredSessions(ctx context.Context) error
- func (q *Queries) DeleteInvitation(ctx context.Context, arg DeleteInvitationParams) (int64, error)
- func (q *Queries) DeleteInvitationsByInviter(ctx context.Context, arg DeleteInvitationsByInviterParams) error
- func (q *Queries) DeleteManagedDomain(ctx context.Context, appID uuid.UUID) error
- func (q *Queries) DeleteMembership(ctx context.Context, arg DeleteMembershipParams) error
- func (q *Queries) DeleteOtherSessionsForUser(ctx context.Context, arg DeleteOtherSessionsForUserParams) error
- func (q *Queries) DeletePassword(ctx context.Context, userID uuid.UUID) (int64, error)
- func (q *Queries) DeleteProject(ctx context.Context, arg DeleteProjectParams) (int64, error)
- func (q *Queries) DeleteSessionByHash(ctx context.Context, tokenHash []byte) error
- func (q *Queries) DeleteSessionsForUser(ctx context.Context, userID uuid.UUID) error
- func (q *Queries) DeleteVariable(ctx context.Context, arg DeleteVariableParams) (int64, error)
- func (q *Queries) DeleteVariableAndBump(ctx context.Context, arg DeleteVariableAndBumpParams) (DeleteVariableAndBumpRow, error)
- func (q *Queries) DeleteVolume(ctx context.Context, arg DeleteVolumeParams) (int64, error)
- func (q *Queries) DeleteVolumeAndBump(ctx context.Context, arg DeleteVolumeAndBumpParams) (DeleteVolumeAndBumpRow, error)
- func (q *Queries) DeployActivity(ctx context.Context, arg DeployActivityParams) ([]DeployActivityRow, error)
- func (q *Queries) FailQueuedBuildOperation(ctx context.Context, arg FailQueuedBuildOperationParams) (int64, error)
- func (q *Queries) FinishBuild(ctx context.Context, arg FinishBuildParams) (Build, error)
- func (q *Queries) FinishDeployment(ctx context.Context, arg FinishDeploymentParams) (Deployment, error)
- func (q *Queries) FinishDeploymentOperation(ctx context.Context, arg FinishDeploymentOperationParams) (int64, error)
- func (q *Queries) GetApp(ctx context.Context, arg GetAppParams) (App, error)
- func (q *Queries) GetAppByID(ctx context.Context, arg GetAppByIDParams) (App, error)
- func (q *Queries) GetAppForReleaseBackfill(ctx context.Context, arg GetAppForReleaseBackfillParams) (App, error)
- func (q *Queries) GetAppHook(ctx context.Context, arg GetAppHookParams) (AppHook, error)
- func (q *Queries) GetAppRelease(ctx context.Context, arg GetAppReleaseParams) (AppRelease, error)
- func (q *Queries) GetBuild(ctx context.Context, arg GetBuildParams) (Build, error)
- func (q *Queries) GetBuildForDeployment(ctx context.Context, arg GetBuildForDeploymentParams) (Build, error)
- func (q *Queries) GetBuildRecoveryOperation(ctx context.Context, arg GetBuildRecoveryOperationParams) (DeploymentOperation, error)
- func (q *Queries) GetClusterJoin(ctx context.Context) (ClusterJoin, error)
- func (q *Queries) GetCustomDomain(ctx context.Context, arg GetCustomDomainParams) (Domain, error)
- func (q *Queries) GetDeployment(ctx context.Context, arg GetDeploymentParams) (Deployment, error)
- func (q *Queries) GetDeploymentOperation(ctx context.Context, arg GetDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) GetDeploymentOperationByDeployment(ctx context.Context, arg GetDeploymentOperationByDeploymentParams) (DeploymentOperation, error)
- func (q *Queries) GetHookForDelivery(ctx context.Context, appID uuid.UUID) (GetHookForDeliveryRow, error)
- func (q *Queries) GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error)
- func (q *Queries) GetLatestSuccessfulBuildForApp(ctx context.Context, arg GetLatestSuccessfulBuildForAppParams) (Build, error)
- func (q *Queries) GetLiveDeploymentOperationForApp(ctx context.Context, arg GetLiveDeploymentOperationForAppParams) (DeploymentOperation, error)
- func (q *Queries) GetLiveSession(ctx context.Context, id uuid.UUID) (GetLiveSessionRow, error)
- func (q *Queries) GetManagedDomain(ctx context.Context, appID uuid.UUID) (Domain, error)
- func (q *Queries) GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
- func (q *Queries) GetPasswordByEmail(ctx context.Context, email string) (GetPasswordByEmailRow, error)
- func (q *Queries) GetPlatformDNS(ctx context.Context) (PlatformDn, error)
- func (q *Queries) GetPlatformRegistry(ctx context.Context) (PlatformRegistry, error)
- func (q *Queries) GetProjectByID(ctx context.Context, arg GetProjectByIDParams) (Project, error)
- func (q *Queries) GetProjectBySlug(ctx context.Context, arg GetProjectBySlugParams) (Project, error)
- func (q *Queries) GetReleaseBackfillState(ctx context.Context, arg GetReleaseBackfillStateParams) (AppReleaseBackfill, error)
- func (q *Queries) GetSession(ctx context.Context, id uuid.UUID) (Session, error)
- func (q *Queries) GetSessionByHash(ctx context.Context, tokenHash []byte) (GetSessionByHashRow, error)
- func (q *Queries) GetSuccessfulBuildForImage(ctx context.Context, arg GetSuccessfulBuildForImageParams) (Build, error)
- func (q *Queries) GetTeam(ctx context.Context, id string) (Team, error)
- func (q *Queries) GetTeamRow(ctx context.Context, id string) (Team, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (q *Queries) GetUserByID(ctx context.Context, id uuid.UUID) (User, error)
- func (q *Queries) GetVariable(ctx context.Context, arg GetVariableParams) (Variable, error)
- func (q *Queries) GetVolume(ctx context.Context, arg GetVolumeParams) (Volume, error)
- func (q *Queries) GrowVolume(ctx context.Context, arg GrowVolumeParams) (int64, error)
- func (q *Queries) GrowVolumeAndBump(ctx context.Context, arg GrowVolumeAndBumpParams) (GrowVolumeAndBumpRow, error)
- func (q *Queries) HasPassword(ctx context.Context, userID uuid.UUID) (bool, error)
- func (q *Queries) HasVerifiedDomainsForApp(ctx context.Context, arg HasVerifiedDomainsForAppParams) (bool, error)
- func (q *Queries) IncrementAppConfigVersion(ctx context.Context, arg IncrementAppConfigVersionParams) (int64, error)
- func (q *Queries) IncrementCNAMEAppConfigVersions(ctx context.Context) error
- func (q *Queries) IncrementGitAppConfigVersions(ctx context.Context) error
- func (q *Queries) ListAdmissiblePushes(ctx context.Context, resultLimit int32) ([]ListAdmissiblePushesRow, error)
- func (q *Queries) ListAppLinks(ctx context.Context, ownerID string) ([]ListAppLinksRow, error)
- func (q *Queries) ListAppReleases(ctx context.Context, arg ListAppReleasesParams) ([]AppRelease, error)
- func (q *Queries) ListApps(ctx context.Context, ownerID string) ([]App, error)
- func (q *Queries) ListAppsForReconciliation(ctx context.Context) ([]App, error)
- func (q *Queries) ListAppsInProject(ctx context.Context, arg ListAppsInProjectParams) ([]App, error)
- func (q *Queries) ListAppsWithLastDeploy(ctx context.Context, ownerID string) ([]ListAppsWithLastDeployRow, error)
- func (q *Queries) ListAppsWithoutProject(ctx context.Context, ownerID string) ([]App, error)
- func (q *Queries) ListCustomDomains(ctx context.Context, arg ListCustomDomainsParams) ([]Domain, error)
- func (q *Queries) ListCustomDomainsForOwner(ctx context.Context, ownerID string) ([]ListCustomDomainsForOwnerRow, error)
- func (q *Queries) ListDeploymentOperations(ctx context.Context, arg ListDeploymentOperationsParams) ([]DeploymentOperation, error)
- func (q *Queries) ListDeployments(ctx context.Context, arg ListDeploymentsParams) ([]Deployment, error)
- func (q *Queries) ListDomainsByApp(ctx context.Context, appID uuid.UUID) ([]Domain, error)
- func (q *Queries) ListMembersOfTeam(ctx context.Context, ownerID string) ([]ListMembersOfTeamRow, error)
- func (q *Queries) ListMembershipsForUser(ctx context.Context, userID uuid.UUID) ([]ListMembershipsForUserRow, error)
- func (q *Queries) ListPendingInvitations(ctx context.Context, ownerID string) ([]ListPendingInvitationsRow, error)
- func (q *Queries) ListPendingReleaseBackfills(ctx context.Context, resultLimit int32) ([]ListPendingReleaseBackfillsRow, error)
- func (q *Queries) ListProjects(ctx context.Context, ownerID string) ([]ListProjectsRow, error)
- func (q *Queries) ListRecentDeployments(ctx context.Context, arg ListRecentDeploymentsParams) ([]ListRecentDeploymentsRow, error)
- func (q *Queries) ListRunningBuilds(ctx context.Context) ([]Build, error)
- func (q *Queries) ListVariablesForApp(ctx context.Context, appID uuid.UUID) ([]Variable, error)
- func (q *Queries) ListVolumesForApp(ctx context.Context, appID uuid.UUID) ([]Volume, error)
- func (q *Queries) LockDeploymentAdmission(ctx context.Context) error
- func (q *Queries) LockPassword(ctx context.Context, userID uuid.UUID) (LockPasswordRow, error)
- func (q *Queries) LockTeam(ctx context.Context, id string) (Team, error)
- func (q *Queries) MarkDomainRouted(ctx context.Context, id uuid.UUID) (int64, error)
- func (q *Queries) MarkHookPending(ctx context.Context, arg MarkHookPendingParams) error
- func (q *Queries) MarkVerifiedDomainsRoutedForApp(ctx context.Context, arg MarkVerifiedDomainsRoutedForAppParams) (int64, error)
- func (q *Queries) MoveAppsWithoutProject(ctx context.Context, arg MoveAppsWithoutProjectParams) (int64, error)
- func (q *Queries) NormalizeLegacyDeploymentStatuses(ctx context.Context) (int64, error)
- func (q *Queries) ReclaimExpiredDeploymentOperations(ctx context.Context) ([]DeploymentOperation, error)
- func (q *Queries) RecordDomainCheck(ctx context.Context, arg RecordDomainCheckParams) (int64, error)
- func (q *Queries) RecordHookDelivery(ctx context.Context, arg RecordHookDeliveryParams) error
- func (q *Queries) RecoverBuiltDeploymentOperation(ctx context.Context, arg RecoverBuiltDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) ReleaseRecoverableDeploymentOperation(ctx context.Context, arg ReleaseRecoverableDeploymentOperationParams) (int64, error)
- func (q *Queries) RenameProject(ctx context.Context, arg RenameProjectParams) (Project, error)
- func (q *Queries) RenewDeploymentOperationLease(ctx context.Context, arg RenewDeploymentOperationLeaseParams) (int64, error)
- func (q *Queries) ReplaceAppLinks(ctx context.Context, arg ReplaceAppLinksParams) error
- func (q *Queries) RequestDomainCheck(ctx context.Context, arg RequestDomainCheckParams) (int64, error)
- func (q *Queries) RestoreAppFromRelease(ctx context.Context, arg RestoreAppFromReleaseParams) (App, error)
- func (q *Queries) RoutableHostsForApp(ctx context.Context, appID uuid.UUID) ([]string, error)
- func (q *Queries) SetActiveRelease(ctx context.Context, arg SetActiveReleaseParams) (int64, error)
- func (q *Queries) SetAppHealth(ctx context.Context, arg SetAppHealthParams) (App, error)
- func (q *Queries) SetAppImage(ctx context.Context, arg SetAppImageParams) (App, error)
- func (q *Queries) SetAppNetworking(ctx context.Context, arg SetAppNetworkingParams) (int64, error)
- func (q *Queries) SetAppPosition(ctx context.Context, arg SetAppPositionParams) (int64, error)
- func (q *Queries) SetAppProject(ctx context.Context, arg SetAppProjectParams) (int64, error)
- func (q *Queries) SetAppReplicas(ctx context.Context, arg SetAppReplicasParams) (App, error)
- func (q *Queries) SetAppRunAsUser(ctx context.Context, arg SetAppRunAsUserParams) error
- func (q *Queries) SetBuildJob(ctx context.Context, arg SetBuildJobParams) error
- func (q *Queries) SetClaimedOperationRelease(ctx context.Context, arg SetClaimedOperationReleaseParams) (int64, error)
- func (q *Queries) SetClusterJoin(ctx context.Context, arg SetClusterJoinParams) (ClusterJoin, error)
- func (q *Queries) SetDeploymentRelease(ctx context.Context, arg SetDeploymentReleaseParams) (int64, error)
- func (q *Queries) SetPlatformDNS(ctx context.Context, arg SetPlatformDNSParams) (PlatformDn, error)
- func (q *Queries) SetPlatformRegistry(ctx context.Context, arg SetPlatformRegistryParams) (PlatformRegistry, error)
- func (q *Queries) SetReleaseBackfillState(ctx context.Context, arg SetReleaseBackfillStateParams) (int64, error)
- func (q *Queries) SetSessionTeam(ctx context.Context, arg SetSessionTeamParams) error
- func (q *Queries) TakeHookPending(ctx context.Context, appID uuid.UUID) (int64, error)
- func (q *Queries) TouchSessionAuthentication(ctx context.Context, id uuid.UUID) (int64, error)
- func (q *Queries) TransitionDeploymentOperation(ctx context.Context, arg TransitionDeploymentOperationParams) (DeploymentOperation, error)
- func (q *Queries) UpdateApp(ctx context.Context, arg UpdateAppParams) (App, error)
- func (q *Queries) UpdatePasswordSecret(ctx context.Context, arg UpdatePasswordSecretParams) (int64, error)
- func (q *Queries) UpsertAppHook(ctx context.Context, arg UpsertAppHookParams) (AppHook, error)
- func (q *Queries) UpsertInvitation(ctx context.Context, arg UpsertInvitationParams) (uuid.UUID, error)
- func (q *Queries) UpsertManagedDomain(ctx context.Context, arg UpsertManagedDomainParams) (Domain, error)
- func (q *Queries) UpsertMembership(ctx context.Context, arg UpsertMembershipParams) (Membership, error)
- func (q *Queries) UpsertPassword(ctx context.Context, arg UpsertPasswordParams) (uuid.UUID, error)
- func (q *Queries) UpsertUser(ctx context.Context, arg UpsertUserParams) (User, error)
- func (q *Queries) UpsertVariable(ctx context.Context, arg UpsertVariableParams) (Variable, error)
- func (q *Queries) UpsertVariableAndBump(ctx context.Context, arg UpsertVariableAndBumpParams) (UpsertVariableAndBumpRow, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordDomainCheckParams
- type RecordHookDeliveryParams
- type RecoverBuiltDeploymentOperationParams
- type ReleaseRecoverableDeploymentOperationParams
- type RenameProjectParams
- type RenewDeploymentOperationLeaseParams
- type ReplaceAppLinksParams
- type RequestDomainCheckParams
- type RestoreAppFromReleaseParams
- type Session
- type SetActiveReleaseParams
- type SetAppHealthParams
- type SetAppImageParams
- type SetAppNetworkingParams
- type SetAppPositionParams
- type SetAppProjectParams
- type SetAppReplicasParams
- type SetAppRunAsUserParams
- type SetBuildJobParams
- type SetClaimedOperationReleaseParams
- type SetClusterJoinParams
- type SetDeploymentReleaseParams
- type SetPlatformDNSParams
- type SetPlatformRegistryParams
- type SetReleaseBackfillStateParams
- type SetSessionTeamParams
- type Team
- type TransitionDeploymentOperationParams
- type UpdateAppParams
- type UpdatePasswordSecretParams
- type UpsertAppHookParams
- type UpsertInvitationParams
- type UpsertManagedDomainParams
- type UpsertMembershipParams
- type UpsertPasswordParams
- type UpsertUserParams
- type UpsertVariableAndBumpParams
- type UpsertVariableAndBumpRow
- type UpsertVariableParams
- type User
- type UserCredential
- type Variable
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptInvitationRow ¶
type App ¶
type App struct {
ID uuid.UUID
OwnerID string
Name string
Namespace string
Image string
Replicas int32
Port int32
CpuRequest string
CpuLimit string
MemoryRequest string
MemoryLimit string
CreatedAt time.Time
UpdatedAt time.Time
HealthPath string
HealthLiveness bool
Source string
Internal bool
ProjectID pgtype.UUID
CanvasX *int32
CanvasY *int32
HttpsOnly bool
CnameOnly bool
RepoUrl string
RepoBranch string
RepoSubdir string
RunAsUser int64
ConfigVersion int64
ActiveReleaseID pgtype.UUID
}
type AppRelease ¶
type AppRelease struct {
ID uuid.UUID
OwnerID string
AppID uuid.UUID
ImageRef string
ImageDigest string
Source string
SourceRevision string
Replicas int32
Port int32
CpuRequest string
CpuLimit string
MemoryRequest string
MemoryLimit string
Internal bool
RunAsUser int64
FsGroup int64
ScratchPaths []string
WritableRootFilesystem bool
HealthPath string
HealthLiveness bool
Env []byte
SecretKeys []string
ConfigVersion int64
CreatedAt time.Time
Origin string
}
type AppReleaseBackfill ¶
type AppendBuildLogParams ¶
type ClusterJoin ¶
type CreateAppLinkParams ¶
type CreateAppParams ¶
type CreateAppReleaseParams ¶
type CreateAppReleaseParams struct {
OwnerID string
AppID uuid.UUID
ImageRef string
ImageDigest string
Source string
SourceRevision string
Replicas int32
Port int32
CpuRequest string
CpuLimit string
MemoryRequest string
MemoryLimit string
Internal bool
RunAsUser int64
FsGroup int64
ScratchPaths []string
WritableRootFilesystem bool
HealthPath string
HealthLiveness bool
Env []byte
SecretKeys []string
ConfigVersion int64
Origin string
}
type CreateBuildParams ¶
type CreateDeploymentParams ¶
type CreateMagicLinkParams ¶
type CreateProjectParams ¶
type CreateSessionParams ¶
type CreateTeamParams ¶
type CreateTeamRowParams ¶
type CreateVolumeAndBumpRow ¶
type CreateVolumeParams ¶
type DeleteAppHookParams ¶ added in v0.2.0
type DeleteAppParams ¶
type DeleteInvitationParams ¶
type DeleteMembershipParams ¶
type DeleteProjectParams ¶
type DeleteVariableParams ¶
type DeleteVolumeAndBumpRow ¶
type DeleteVolumeParams ¶
type DeployActivityParams ¶
type Deployment ¶
type DeploymentOperation ¶
type DeploymentOperation struct {
ID uuid.UUID
OwnerID string
AppID uuid.UUID
DeploymentID uuid.UUID
ReleaseID pgtype.UUID
RequiresBuild bool
Status string
Message string
CreatedAt time.Time
ClaimedAt pgtype.Timestamptz
FinishedAt pgtype.Timestamptz
ClaimToken pgtype.UUID
LeaseExpiresAt pgtype.Timestamptz
CancelledAt pgtype.Timestamptz
Checkpoint string
StageStartedAt time.Time
}
type Domain ¶
type Domain struct {
ID uuid.UUID
OwnerID string
AppID uuid.UUID
Host string
Tls bool
CreatedAt time.Time
Managed bool
VerifiedAt pgtype.Timestamptz
VerifyTarget string
State string
Observed string
LastError string
LastCheckedAt pgtype.Timestamptz
NextCheckAt time.Time
CheckAttempts int32
Verified bool
}
type FinishBuildParams ¶
type FinishDeploymentParams ¶
type GetAppByIDParams ¶
type GetAppHookParams ¶ added in v0.2.0
type GetAppParams ¶
type GetAppReleaseParams ¶
type GetBuildParams ¶
type GetCustomDomainParams ¶
type GetDeploymentParams ¶
type GetHookForDeliveryRow ¶ added in v0.2.0
type GetInvitationByHashRow ¶
type GetLiveSessionRow ¶
type GetMembershipParams ¶
type GetPasswordByEmailRow ¶
type GetProjectByIDParams ¶
type GetProjectBySlugParams ¶
type GetSessionByHashRow ¶
type GetVariableParams ¶
type GrowVolumeAndBumpParams ¶
type GrowVolumeAndBumpRow ¶
type GrowVolumeParams ¶
type Invitation ¶
type ListAdmissiblePushesRow ¶ added in v0.2.0
type ListAppLinksRow ¶
type ListAppReleasesParams ¶
type ListAppsInProjectParams ¶
type ListCustomDomainsParams ¶
type ListDeploymentsParams ¶
type ListMembersOfTeamRow ¶
type ListProjectsRow ¶
type ListRecentDeploymentsRow ¶
type ListRecentDeploymentsRow struct {
ID uuid.UUID
OwnerID string
AppID uuid.UUID
Image string
Revision string
Status string
Message string
StartedAt time.Time
FinishedAt pgtype.Timestamptz
ReleaseID pgtype.UUID
Trigger string
ActorKind string
ActorID string
AppName string
AppNamespace string
ActiveReleaseID pgtype.UUID
}
type LockPasswordRow ¶
type MarkHookPendingParams ¶ added in v0.2.0
type Membership ¶
type PlatformDn ¶
type PlatformRegistry ¶
type Querier ¶
type Querier interface {
// One conditional UPDATE, like the magic link: checking first and writing after
// leaves a window in which the same invitation is accepted twice.
AcceptInvitation(ctx context.Context, tokenHash []byte) (AcceptInvitationRow, error)
// Appended rather than replaced, so a build streaming its output does not have
// to hold the whole log in memory to write any of it.
AppendBuildLog(ctx context.Context, arg AppendBuildLogParams) error
CancelDeploymentOperation(ctx context.Context, arg CancelDeploymentOperationParams) (DeploymentOperation, error)
ClaimDeploymentOperation(ctx context.Context, arg ClaimDeploymentOperationParams) (DeploymentOperation, error)
// Claims the domains whose next check is due, and leases them.
//
// Two things at once, and both matter.
//
// FOR UPDATE SKIP LOCKED is what lets the checker run on every replica without
// those replicas agreeing on anything: each takes rows nobody else holds, and a
// row already being worked on is skipped rather than waited for. The build
// reconciler is safe on several replicas for the same reason.
//
// Pushing next_check_at forward in the same statement is what keeps the lock
// short. The alternative — holding the transaction open while the lookups run —
// would hold row locks for as long as DNS takes to answer, which is unbounded
// and occasionally seconds. Leasing instead means the claim is committed
// immediately and the network happens outside any transaction; a checker that
// dies mid-pass simply lets the lease expire, and the next pass picks the row
// up again.
ClaimDomainsDueForCheck(ctx context.Context, arg ClaimDomainsDueForCheckParams) ([]Domain, error)
ClaimNextDeploymentOperation(ctx context.Context, arg ClaimNextDeploymentOperationParams) (DeploymentOperation, error)
// Applying and verifying are recovered from workload observation, never by
// the ordinary admission worker. The checkpoint tells this claimant which
// stage the dead worker had durably entered.
ClaimRecoverableDeploymentOperation(ctx context.Context, arg ClaimRecoverableDeploymentOperationParams) (DeploymentOperation, error)
ClearClusterJoin(ctx context.Context) (int64, error)
ClearPlatformRegistry(ctx context.Context) error
// Forget every saved position in a project, so the next render lays it out
// again from the dependencies.
ClearProjectPositions(ctx context.Context, arg ClearProjectPositionsParams) (int64, error)
// Marking consumed and reading the user are one statement, so there is no
// window between the two in which a second request can also find the link
// unconsumed. Expiry is in the same condition for the same reason: a link that
// has just expired must fail here rather than in whatever checks it later.
ConsumeMagicLink(ctx context.Context, tokenHash []byte) (User, error)
CountApps(ctx context.Context, ownerID string) (int64, error)
CountOwnersOfTeam(ctx context.Context, ownerID string) (int64, error)
CountPendingReleaseBackfills(ctx context.Context) (int64, error)
CreateApp(ctx context.Context, arg CreateAppParams) (App, error)
CreateAppLink(ctx context.Context, arg CreateAppLinkParams) error
// Release snapshots are owner-scoped at every read and write, like every
// other resource. There is intentionally no update query: a release is a fact
// about a past deployment, not editable configuration.
CreateAppRelease(ctx context.Context, arg CreateAppReleaseParams) (AppRelease, error)
// Builds. Owner-scoped in the row rather than through the deployment, because
// the log is readable output and the scoping has to be checkable in the query
// that reads it.
CreateBuild(ctx context.Context, arg CreateBuildParams) (Build, error)
// ---------------------------------------------------------- custom domains
// Claims a hostname for an app, unverified.
//
// Deliberately not an upsert on host: the global unique index is what makes two
// teams claiming one name an error rather than a silent transfer, and papering
// over it here is exactly how a domain gets stolen.
//
// next_check_at defaults to now(), so a claim is picked up by the checker on its
// next pass rather than waiting for somebody to press a button. That is the
// whole difference between this and what it replaced.
CreateCustomDomain(ctx context.Context, arg CreateCustomDomainParams) (Domain, error)
CreateDeployment(ctx context.Context, arg CreateDeploymentParams) (Deployment, error)
CreateDeploymentOperation(ctx context.Context, arg CreateDeploymentOperationParams) (DeploymentOperation, error)
CreateMagicLink(ctx context.Context, arg CreateMagicLinkParams) (MagicLink, error)
// Every query filters by owner_id, for the reason apps.sql gives: the scope is
// the check, not a duplicate of one.
CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
CreateTeam(ctx context.Context, arg CreateTeamParams) (Team, error)
// Every query filters by owner_id.
//
// This is not defensive duplication of an application-level check — it is the
// check. A handler that forgets to scope produces no rows here rather than
// another owner's data, and sqlc makes the parameter impossible to omit
// because the generated signature requires it.
CreateTeamRow(ctx context.Context, arg CreateTeamRowParams) (Team, error)
// Storage attached to an app. Scoped by owner_id like every other resource
// query: a handler that forgets to scope produces no rows here rather than
// another team's storage.
CreateVolume(ctx context.Context, arg CreateVolumeParams) (Volume, error)
CreateVolumeAndBump(ctx context.Context, arg CreateVolumeAndBumpParams) (CreateVolumeAndBumpRow, error)
DeleteApp(ctx context.Context, arg DeleteAppParams) error
DeleteAppHook(ctx context.Context, arg DeleteAppHookParams) (int64, error)
DeleteCustomDomain(ctx context.Context, arg DeleteCustomDomainParams) (int64, error)
DeleteExpiredInvitations(ctx context.Context) error
DeleteExpiredMagicLinks(ctx context.Context) error
DeleteExpiredSessions(ctx context.Context) error
// Scoped by owner_id as well as id: an id from another team must not be
// reachable by someone who happens to administer this one.
DeleteInvitation(ctx context.Context, arg DeleteInvitationParams) (int64, error)
// Withdraws the invitations somebody issued, used when they lose the authority
// to have issued them. An administrator who leaves must not keep a live token
// for an address they control.
DeleteInvitationsByInviter(ctx context.Context, arg DeleteInvitationsByInviterParams) error
// Releases an app's platform hostname.
//
// Deleting rather than leaving the row is what makes the feature reversible:
// hostnames are globally unique, so a retired row keeps the name reserved
// against every other app forever.
DeleteManagedDomain(ctx context.Context, appID uuid.UUID) error
DeleteMembership(ctx context.Context, arg DeleteMembershipParams) error
// Ends every session but the one asking.
//
// DeleteSessionsForUser cannot serve here: it takes out the caller's own, so
// changing a password from the account page would sign the person out of the
// browser they are looking at, and they would read that as the change having
// failed rather than having worked.
// The surviving session is named `keep` rather than `except`, which is a
// reserved word the query parser will not take as an identifier.
DeleteOtherSessionsForUser(ctx context.Context, arg DeleteOtherSessionsForUserParams) error
// execrows so that "there was nothing to remove" is distinguishable from
// success. Reporting a credential withdrawn when none existed is how somebody
// stops looking for the one that is still there.
DeletePassword(ctx context.Context, userID uuid.UUID) (int64, error)
DeleteProject(ctx context.Context, arg DeleteProjectParams) (int64, error)
DeleteSessionByHash(ctx context.Context, tokenHash []byte) error
DeleteSessionsForUser(ctx context.Context, userID uuid.UUID) error
DeleteVariable(ctx context.Context, arg DeleteVariableParams) (int64, error)
DeleteVariableAndBump(ctx context.Context, arg DeleteVariableAndBumpParams) (DeleteVariableAndBumpRow, error)
DeleteVolume(ctx context.Context, arg DeleteVolumeParams) (int64, error)
DeleteVolumeAndBump(ctx context.Context, arg DeleteVolumeAndBumpParams) (DeleteVolumeAndBumpRow, error)
// Deploys per day and outcome, for the overview chart.
//
// Counted in the database rather than by reading rows and tallying them in Go:
// a busy month is thousands of deployments, and none of them are wanted here
// except as a number.
//
// Days with no deploys are absent from this result. The caller fills them in;
// see app.DeployActivity for why that cannot be skipped.
DeployActivity(ctx context.Context, arg DeployActivityParams) ([]DeployActivityRow, error)
FailQueuedBuildOperation(ctx context.Context, arg FailQueuedBuildOperationParams) (int64, error)
FinishBuild(ctx context.Context, arg FinishBuildParams) (Build, error)
FinishDeployment(ctx context.Context, arg FinishDeploymentParams) (Deployment, error)
FinishDeploymentOperation(ctx context.Context, arg FinishDeploymentOperationParams) (int64, error)
GetApp(ctx context.Context, arg GetAppParams) (App, error)
GetAppByID(ctx context.Context, arg GetAppByIDParams) (App, error)
GetAppForReleaseBackfill(ctx context.Context, arg GetAppForReleaseBackfillParams) (App, error)
GetAppHook(ctx context.Context, arg GetAppHookParams) (AppHook, error)
GetAppRelease(ctx context.Context, arg GetAppReleaseParams) (AppRelease, error)
GetBuild(ctx context.Context, arg GetBuildParams) (Build, error)
GetBuildForDeployment(ctx context.Context, arg GetBuildForDeploymentParams) (Build, error)
GetBuildRecoveryOperation(ctx context.Context, arg GetBuildRecoveryOperationParams) (DeploymentOperation, error)
// The join settings are install-wide, so unlike every other query here these
// take no owner_id. See the 00012 migration for why.
GetClusterJoin(ctx context.Context) (ClusterJoin, error)
GetCustomDomain(ctx context.Context, arg GetCustomDomainParams) (Domain, error)
GetDeployment(ctx context.Context, arg GetDeploymentParams) (Deployment, error)
GetDeploymentOperation(ctx context.Context, arg GetDeploymentOperationParams) (DeploymentOperation, error)
GetDeploymentOperationByDeployment(ctx context.Context, arg GetDeploymentOperationByDeploymentParams) (DeploymentOperation, error)
// By app id alone: a delivery carries no session and no owner. The signature,
// checked against the secret read here, is what authorises it.
GetHookForDelivery(ctx context.Context, appID uuid.UUID) (GetHookForDeliveryRow, error)
// Reads an invitation without spending it, so a signed-out visitor can be sent
// a sign-in link to the address it names. token_hash is not among the columns,
// for the same reason it is absent from ListPendingInvitations.
GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error)
GetLatestSuccessfulBuildForApp(ctx context.Context, arg GetLatestSuccessfulBuildForAppParams) (Build, error)
// The live operation is the only candidate allowed to displace an app's
// active release. Steady-state convergence must stand down while one exists.
GetLiveDeploymentOperationForApp(ctx context.Context, arg GetLiveDeploymentOperationForAppParams) (DeploymentOperation, error)
// ---------------------------------------------------------------------------
// Step-up and session revocation
// ---------------------------------------------------------------------------
// Reads a session that is still alive, for a caller about to change how the
// account it belongs to can be signed in to.
//
// GetSession has no expiry filter, so an expired row comes back from it looking
// valid. GetSessionByHash filters expiry in SQL precisely so that a caller
// cannot forget, and this is the caller that would: a session that ended an hour
// ago must not be able to set a password. FOR UPDATE serialises two tabs
// changing one at the same moment.
//
// Columns are named because the row exists to answer three questions — whose it
// is, how recently it was proved, whether it is still alive — and starring it
// would hand the caller a struct that grows every time `sessions` does.
GetLiveSession(ctx context.Context, id uuid.UUID) (GetLiveSessionRow, error)
GetManagedDomain(ctx context.Context, appID uuid.UUID) (Domain, error)
GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
// ---------------------------------------------------------------------------
// Passwords
//
// Every query below either names its columns or returns an id. `secret` appears
// in two of them — the sign-in lookup and the locking read that a change or a
// removal goes through — and both row types are consumed inside the account
// package and never returned from it. That is the whole storage rule, and it is
// easier to keep by making the leak impossible than by remembering not to write
// it. Anything added here that does not need the hash must not select it.
// ---------------------------------------------------------------------------
// The only query that returns a hash, and the only one that ever should.
//
// The join is INNER, so an unknown address and a known address with no password
// come back as the same pgx.ErrNoRows. There is no branch in Go that could tell
// them apart, which is what makes the equal-cost verify in AuthenticatePassword
// structural rather than something a caller has to remember to write.
//
// The user's columns are named rather than starred, so this cannot quietly start
// returning whatever is added to `users` next.
GetPasswordByEmail(ctx context.Context, email string) (GetPasswordByEmailRow, error)
// Install-wide DNS settings. No owner_id, for the reason cluster_join has
// none: they configure one controller shared by every team.
GetPlatformDNS(ctx context.Context) (PlatformDn, error)
// The install's image registry. No owner_id, for the reason platform_dns has
// none: one registry serves every team's builds.
GetPlatformRegistry(ctx context.Context) (PlatformRegistry, error)
GetProjectByID(ctx context.Context, arg GetProjectByIDParams) (Project, error)
GetProjectBySlug(ctx context.Context, arg GetProjectBySlugParams) (Project, error)
GetReleaseBackfillState(ctx context.Context, arg GetReleaseBackfillStateParams) (AppReleaseBackfill, error)
// Expiry is filtered here for the reason GetSessionByHash gives: so that an
// expired row can never be treated as valid by a caller that forgets to check.
// This one used to be the caller that forgot. It was not reachable with a dead
// session — the route gate resolves a live one first — but "not reachable"
// is a property of today's routing rather than of this query, and the whole
// point of putting the condition in SQL is that it does not depend on that.
GetSession(ctx context.Context, id uuid.UUID) (Session, error)
// The team is joined in because the request that carries this cookie needs the
// owner it resolves to, and a second round trip per request buys nothing. The
// join is LEFT: a session whose team was deleted still exists, it just has no
// owner to act as.
//
// Expiry is filtered in SQL rather than in Go so that an expired row can never
// be treated as valid by a caller that forgets to check.
// Resolves a session only while the membership behind it still exists.
//
// The join to memberships is the security boundary, not decoration. Revoking
// sessions imperatively when someone is removed would work only for the call
// sites that remember to do it, and would still miss membership lost by
// cascade. Joining makes a departed member's cookie stop resolving the instant
// the row goes, by whatever route it went.
//
// INNER JOIN on teams too: a session with no active team resolves to no owner,
// and returning a row the caller must then remember to reject is how that
// check gets skipped.
GetSessionByHash(ctx context.Context, tokenHash []byte) (GetSessionByHashRow, error)
GetSuccessfulBuildForImage(ctx context.Context, arg GetSuccessfulBuildForImageParams) (Build, error)
GetTeam(ctx context.Context, id string) (Team, error)
GetTeamRow(ctx context.Context, id string) (Team, error)
GetUserByEmail(ctx context.Context, email string) (User, error)
GetUserByID(ctx context.Context, id uuid.UUID) (User, error)
GetVariable(ctx context.Context, arg GetVariableParams) (Variable, error)
GetVolume(ctx context.Context, arg GetVolumeParams) (Volume, error)
// Expansion only, enforced in the WHERE clause rather than by reading the row
// and comparing in Go: a check the caller performs is one a caller can skip,
// and Kubernetes cannot shrink a claim afterwards to undo it.
GrowVolume(ctx context.Context, arg GrowVolumeParams) (int64, error)
GrowVolumeAndBump(ctx context.Context, arg GrowVolumeAndBumpParams) (GrowVolumeAndBumpRow, error)
HasPassword(ctx context.Context, userID uuid.UUID) (bool, error)
HasVerifiedDomainsForApp(ctx context.Context, arg HasVerifiedDomainsForAppParams) (bool, error)
IncrementAppConfigVersion(ctx context.Context, arg IncrementAppConfigVersionParams) (int64, error)
// The platform CNAME target is an install-wide live overlay, but it only
// renders into apps that explicitly opted into CNAME routing.
IncrementCNAMEAppConfigVersions(ctx context.Context) error
// Registry credentials are a live overlay for every Git-built image. They are
// install-wide, so one settings mutation invalidates each Git app exactly
// once without manufacturing release history.
IncrementGitAppConfigVersions(ctx context.Context) error
// Pushes waiting behind a deploy that has since ended. An app whose deploy is
// still live is left out, rather than tried and refused every half second.
ListAdmissiblePushes(ctx context.Context, resultLimit int32) ([]ListAdmissiblePushesRow, error)
ListAppLinks(ctx context.Context, ownerID string) ([]ListAppLinksRow, error)
ListAppReleases(ctx context.Context, arg ListAppReleasesParams) ([]AppRelease, error)
ListApps(ctx context.Context, ownerID string) ([]App, error)
// Apps whose database pointer names the workload the cluster must converge to.
// This is intentionally install-scoped: the reconciler acts from stored
// ownership rather than from an authenticated request.
ListAppsForReconciliation(ctx context.Context) ([]App, error)
ListAppsInProject(ctx context.Context, arg ListAppsInProjectParams) ([]App, error)
// Every app, with how its most recent deployment ended.
//
// A failed deploy leaves the previous workload running, so the app's live
// status stays green and nothing in a list of apps says the last attempt to
// change it did not take. That is exactly the deploy somebody needs to find,
// and until this query existed the only way to find it was to open each app.
//
// LATERAL rather than a window function or a join on max(started_at): one index
// lookup per app, and it reads as what it is — the latest row for this app.
ListAppsWithLastDeploy(ctx context.Context, ownerID string) ([]ListAppsWithLastDeployRow, error)
// Apps that predate projects, or whose project was deleted.
//
// Returned separately rather than folded into a default project by the query,
// because assigning one is a write and a read should not have side effects
// that a caller cannot see.
ListAppsWithoutProject(ctx context.Context, ownerID string) ([]App, error)
ListCustomDomains(ctx context.Context, arg ListCustomDomainsParams) ([]Domain, error)
// Every custom domain on the install, worst first.
//
// Nothing answered "which domains are stuck" before this. A domain that is not
// routed is the only kind anybody needs to find, so it sorts to the top.
ListCustomDomainsForOwner(ctx context.Context, ownerID string) ([]ListCustomDomainsForOwnerRow, error)
ListDeploymentOperations(ctx context.Context, arg ListDeploymentOperationsParams) ([]DeploymentOperation, error)
ListDeployments(ctx context.Context, arg ListDeploymentsParams) ([]Deployment, error)
ListDomainsByApp(ctx context.Context, appID uuid.UUID) ([]Domain, error)
ListMembersOfTeam(ctx context.Context, ownerID string) ([]ListMembersOfTeamRow, error)
ListMembershipsForUser(ctx context.Context, userID uuid.UUID) ([]ListMembershipsForUserRow, error)
// The columns are named rather than starred, and token_hash is not among them.
// This list feeds the team page, and a hash that never leaves the database
// cannot be rendered into it by a template that innocently prints a struct.
ListPendingInvitations(ctx context.Context, ownerID string) ([]ListPendingInvitationsRow, error)
ListPendingReleaseBackfills(ctx context.Context, resultLimit int32) ([]ListPendingReleaseBackfillsRow, error)
ListProjects(ctx context.Context, ownerID string) ([]ListProjectsRow, error)
// Joined to apps so the activity feed can name the workload without a second
// round trip per row. The join is on app_id AND owner_id: joining on app_id
// alone would be correct today and wrong the moment more than one owner exists.
ListRecentDeployments(ctx context.Context, arg ListRecentDeploymentsParams) ([]ListRecentDeploymentsRow, error)
// Every build still claiming to run, oldest first. Not owner-scoped: this
// feeds the reconciler, which is the platform settling its own records rather
// than a team reading theirs.
ListRunningBuilds(ctx context.Context) ([]Build, error)
ListVariablesForApp(ctx context.Context, appID uuid.UUID) ([]Variable, error)
ListVolumesForApp(ctx context.Context, appID uuid.UUID) ([]Volume, error)
// Claim counting and selection must share this transaction-wide lock. Row
// locks alone protect candidates, not the cluster-wide count: two connections
// can otherwise lock different rows after both observed one free build slot.
LockDeploymentAdmission(ctx context.Context) error
// Reads and locks the person's password, for a caller inside a transaction that
// is about to replace or remove it.
//
// Returns the secret as well as the id because one row answers two questions the
// caller needs at the same moment: whether this is an add or a replace, since
// only a replace revokes the person's other sessions, and whether a current
// password offered as proof of recent authentication is the right one. Asking
// twice would be two round trips and one more chance for the second to read a
// different row than the first.
//
// FOR UPDATE is what serialises two tabs. Read outside the transaction this
// would be check-then-act: both see no password, both insert, one upserts over
// the other, and neither revokes.
LockPassword(ctx context.Context, userID uuid.UUID) (LockPasswordRow, error)
// A role change reads the owner count and then writes; taking the team row
// first serialises those pairs, so two concurrent demotions cannot both see
// two owners and both proceed.
LockTeam(ctx context.Context, id string) (Team, error)
// Moves a proven domain to routed, once the Ingress actually carries it.
//
// Guarded on the state it is coming from, so a check that has since found drift
// is not overwritten by an apply that started before it.
MarkDomainRouted(ctx context.Context, id uuid.UUID) (int64, error)
MarkHookPending(ctx context.Context, arg MarkHookPendingParams) error
// A verified domain becomes routed only after the app reconciler has observed
// or produced the matching workload convergence key. This app-scoped form
// closes the asynchronous handoff from the DNS checker.
MarkVerifiedDomainsRoutedForApp(ctx context.Context, arg MarkVerifiedDomainsRoutedForAppParams) (int64, error)
MoveAppsWithoutProject(ctx context.Context, arg MoveAppsWithoutProjectParams) (int64, error)
NormalizeLegacyDeploymentStatuses(ctx context.Context) (int64, error)
ReclaimExpiredDeploymentOperations(ctx context.Context) ([]DeploymentOperation, error)
// Records what a check saw.
//
// Not scoped by owner, and deliberately: the background checker works through
// every install's rows by id, having already claimed them below. Owner scoping
// protects a request that names a row; this is not one. Every path that reaches
// here from a request goes through GetCustomDomain first, which is scoped.
//
// The schedule arrives already computed rather than being worked out in SQL, so
// the backoff can be tested against an injected clock instead of against now().
RecordDomainCheck(ctx context.Context, arg RecordDomainCheckParams) (int64, error)
RecordHookDelivery(ctx context.Context, arg RecordHookDeliveryParams) error
RecoverBuiltDeploymentOperation(ctx context.Context, arg RecoverBuiltDeploymentOperationParams) (DeploymentOperation, error)
// A cluster outage is not a deployment failure. Give observation recovery
// back to the queue without changing its checkpoint or verification budget.
ReleaseRecoverableDeploymentOperation(ctx context.Context, arg ReleaseRecoverableDeploymentOperationParams) (int64, error)
RenameProject(ctx context.Context, arg RenameProjectParams) (Project, error)
RenewDeploymentOperationLease(ctx context.Context, arg RenewDeploymentOperationLeaseParams) (int64, error)
ReplaceAppLinks(ctx context.Context, arg ReplaceAppLinksParams) error
// Brings a domain's next check forward. What the "Check now" button does.
//
// It resets the attempt count as well, because somebody pressing it is telling
// us the situation changed — and a domain that had backed off to a fifteen
// minute interval should not go straight back to one.
RequestDomainCheck(ctx context.Context, arg RequestDomainCheckParams) (int64, error)
// Rollback makes the app's desired state the release's again, so the next edit
// builds on what is running rather than quietly rolling forward to what was
// replaced. Only release-owned fields: hostnames, networking, storage and the
// repository are current state and stay as they are. The uid is a build's
// discovery for a Git app, and belongs to the image being restored.
RestoreAppFromRelease(ctx context.Context, arg RestoreAppFromReleaseParams) (App, error)
// Hostnames that may actually be routed to.
//
// A managed host is routable because the platform issued it; a custom one only
// once it is proven. This is the query the Ingress is built from, so the gate
// lives here rather than in a caller that might forget it.
RoutableHostsForApp(ctx context.Context, appID uuid.UUID) ([]string, error)
SetActiveRelease(ctx context.Context, arg SetActiveReleaseParams) (int64, error)
SetAppHealth(ctx context.Context, arg SetAppHealthParams) (App, error)
// The image a build produced. Separate from UpdateApp because a build sets
// only this: the replicas and limits a person configured are not a build's to
// overwrite, and passing them through would make every build a chance to.
SetAppImage(ctx context.Context, arg SetAppImageParams) (App, error)
SetAppNetworking(ctx context.Context, arg SetAppNetworkingParams) (int64, error)
SetAppPosition(ctx context.Context, arg SetAppPositionParams) (int64, error)
SetAppProject(ctx context.Context, arg SetAppProjectParams) (int64, error)
SetAppReplicas(ctx context.Context, arg SetAppReplicasParams) (App, error)
// Recorded by a build, which is the only thing that can discover it. The
// image update owns the build operation's single config_version increment.
SetAppRunAsUser(ctx context.Context, arg SetAppRunAsUserParams) error
SetBuildJob(ctx context.Context, arg SetBuildJobParams) error
SetClaimedOperationRelease(ctx context.Context, arg SetClaimedOperationReleaseParams) (int64, error)
SetClusterJoin(ctx context.Context, arg SetClusterJoinParams) (ClusterJoin, error)
SetDeploymentRelease(ctx context.Context, arg SetDeploymentReleaseParams) (int64, error)
SetPlatformDNS(ctx context.Context, arg SetPlatformDNSParams) (PlatformDn, error)
SetPlatformRegistry(ctx context.Context, arg SetPlatformRegistryParams) (PlatformRegistry, error)
SetReleaseBackfillState(ctx context.Context, arg SetReleaseBackfillStateParams) (int64, error)
SetSessionTeam(ctx context.Context, arg SetSessionTeamParams) error
// Cleared in the same transaction that admits the deploy, so a push is either
// still waiting or has a deployment — never neither.
TakeHookPending(ctx context.Context, appID uuid.UUID) (int64, error)
// Opens the step-up window. Scoped by expiry so an expired session cannot be
// revived into a recently-authenticated one; execrows so the caller can tell
// that it was not.
TouchSessionAuthentication(ctx context.Context, id uuid.UUID) (int64, error)
TransitionDeploymentOperation(ctx context.Context, arg TransitionDeploymentOperationParams) (DeploymentOperation, error)
// Everything about an app a person is allowed to change after creating it.
//
// Deliberately not replicas: scaling has its own query because it has its own
// rule about storage, and folding it in here would make every settings save a
// chance to silently reset a scale somebody had chosen.
//
// Nor the health probe, the networking toggles or run_as_user — each of those
// already has a query shaped to what it means, and this one exists for the
// fields that had no way to be changed at all.
UpdateApp(ctx context.Context, arg UpdateAppParams) (App, error)
// Rehash-on-login, for a stored hash made at a cost this build has moved past.
// Best effort and never on the critical path: the sign-in has already succeeded
// by the time this runs.
//
// Conditional on the old value, which makes it a compare-and-swap. Between the
// verify and this update the person may have changed their password in another
// tab; without the condition, the rehash of the OLD password would overwrite the
// new one and lock them out of an account they had just secured. With it, a
// stale rehash matches no rows and nothing happens.
UpdatePasswordSecret(ctx context.Context, arg UpdatePasswordSecretParams) (int64, error)
// Deploy-on-push webhooks. See migration 00028.
// A new secret replaces the old one outright, so regenerating is also how a
// leaked secret is revoked.
UpsertAppHook(ctx context.Context, arg UpsertAppHookParams) (AppHook, error)
// Re-inviting replaces the pending invitation rather than adding a second one,
// so the token in the older mail stops working. Two live tokens for one address
// would mean revoking the invitation on screen leaves the other one usable.
UpsertInvitation(ctx context.Context, arg UpsertInvitationParams) (uuid.UUID, error)
// Platform-issued hostnames. Custom domains get their own queries when that
// sub-project lands; keeping them in one file rather than in apps.sql is so
// that apps.sql stays about apps.
// Issues or reissues the platform hostname for an app.
//
// The conflict target is the partial index, so a second call for the same app
// moves its hostname rather than adding one. A collision on the global host
// index is a different conflict and is deliberately left to raise, because two
// apps claiming one hostname is a real error, not something to paper over.
//
// The state is 'routed' because a name the platform issued needs no proof of
// ownership; requiring proof would mean inventing a verification step for a
// name we already control. verified follows from it and is not written here —
// it is generated from state, so that the routing gate and the state on screen
// cannot disagree.
UpsertManagedDomain(ctx context.Context, arg UpsertManagedDomainParams) (Domain, error)
UpsertMembership(ctx context.Context, arg UpsertMembershipParams) (Membership, error)
// Returns an id and not the row. RETURNING * here would put the hash into a Go
// struct for no reason at all, which is the shortest route to it being logged.
UpsertPassword(ctx context.Context, arg UpsertPasswordParams) (uuid.UUID, error)
// Users, sessions and credentials carry no owner_id: a person exists before they
// belong to any team, and what proves who they are is not a fact about a tenant.
// Memberships and invitations do, and stay scoped by it like everything else.
UpsertUser(ctx context.Context, arg UpsertUserParams) (User, error)
// Environment variables, one row each so a secret can be sealed while its
// neighbour stays readable.
// Upsert rather than insert: setting a variable that already exists is what a
// person means by editing one, and a separate update path would need the
// caller to know which case they are in.
UpsertVariable(ctx context.Context, arg UpsertVariableParams) (Variable, error)
UpsertVariableAndBump(ctx context.Context, arg UpsertVariableAndBumpParams) (UpsertVariableAndBumpRow, error)
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AcceptInvitation ¶
func (q *Queries) AcceptInvitation(ctx context.Context, tokenHash []byte) (AcceptInvitationRow, error)
One conditional UPDATE, like the magic link: checking first and writing after leaves a window in which the same invitation is accepted twice.
func (*Queries) AppendBuildLog ¶
func (q *Queries) AppendBuildLog(ctx context.Context, arg AppendBuildLogParams) error
Appended rather than replaced, so a build streaming its output does not have to hold the whole log in memory to write any of it.
func (*Queries) CancelDeploymentOperation ¶
func (q *Queries) CancelDeploymentOperation(ctx context.Context, arg CancelDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) ClaimDeploymentOperation ¶
func (q *Queries) ClaimDeploymentOperation(ctx context.Context, arg ClaimDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) ClaimDomainsDueForCheck ¶
func (q *Queries) ClaimDomainsDueForCheck(ctx context.Context, arg ClaimDomainsDueForCheckParams) ([]Domain, error)
Claims the domains whose next check is due, and leases them.
Two things at once, and both matter.
FOR UPDATE SKIP LOCKED is what lets the checker run on every replica without those replicas agreeing on anything: each takes rows nobody else holds, and a row already being worked on is skipped rather than waited for. The build reconciler is safe on several replicas for the same reason.
Pushing next_check_at forward in the same statement is what keeps the lock short. The alternative — holding the transaction open while the lookups run — would hold row locks for as long as DNS takes to answer, which is unbounded and occasionally seconds. Leasing instead means the claim is committed immediately and the network happens outside any transaction; a checker that dies mid-pass simply lets the lease expire, and the next pass picks the row up again.
func (*Queries) ClaimNextDeploymentOperation ¶
func (q *Queries) ClaimNextDeploymentOperation(ctx context.Context, arg ClaimNextDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) ClaimRecoverableDeploymentOperation ¶
func (q *Queries) ClaimRecoverableDeploymentOperation(ctx context.Context, arg ClaimRecoverableDeploymentOperationParams) (DeploymentOperation, error)
Applying and verifying are recovered from workload observation, never by the ordinary admission worker. The checkpoint tells this claimant which stage the dead worker had durably entered.
func (*Queries) ClearClusterJoin ¶
func (*Queries) ClearPlatformRegistry ¶
func (*Queries) ClearProjectPositions ¶
func (q *Queries) ClearProjectPositions(ctx context.Context, arg ClearProjectPositionsParams) (int64, error)
Forget every saved position in a project, so the next render lays it out again from the dependencies.
func (*Queries) ConsumeMagicLink ¶
Marking consumed and reading the user are one statement, so there is no window between the two in which a second request can also find the link unconsumed. Expiry is in the same condition for the same reason: a link that has just expired must fail here rather than in whatever checks it later.
func (*Queries) CountOwnersOfTeam ¶
func (*Queries) CountPendingReleaseBackfills ¶
func (*Queries) CreateAppLink ¶
func (q *Queries) CreateAppLink(ctx context.Context, arg CreateAppLinkParams) error
func (*Queries) CreateAppRelease ¶
func (q *Queries) CreateAppRelease(ctx context.Context, arg CreateAppReleaseParams) (AppRelease, error)
Release snapshots are owner-scoped at every read and write, like every other resource. There is intentionally no update query: a release is a fact about a past deployment, not editable configuration.
func (*Queries) CreateBuild ¶
Builds. Owner-scoped in the row rather than through the deployment, because the log is readable output and the scoping has to be checkable in the query that reads it.
func (*Queries) CreateCustomDomain ¶
func (q *Queries) CreateCustomDomain(ctx context.Context, arg CreateCustomDomainParams) (Domain, error)
---------------------------------------------------------- custom domains Claims a hostname for an app, unverified.
Deliberately not an upsert on host: the global unique index is what makes two teams claiming one name an error rather than a silent transfer, and papering over it here is exactly how a domain gets stolen.
next_check_at defaults to now(), so a claim is picked up by the checker on its next pass rather than waiting for somebody to press a button. That is the whole difference between this and what it replaced.
func (*Queries) CreateDeployment ¶
func (q *Queries) CreateDeployment(ctx context.Context, arg CreateDeploymentParams) (Deployment, error)
func (*Queries) CreateDeploymentOperation ¶
func (q *Queries) CreateDeploymentOperation(ctx context.Context, arg CreateDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) CreateMagicLink ¶
func (*Queries) CreateProject ¶
Every query filters by owner_id, for the reason apps.sql gives: the scope is the check, not a duplicate of one.
func (*Queries) CreateSession ¶
func (*Queries) CreateTeam ¶
func (*Queries) CreateTeamRow ¶
Every query filters by owner_id.
This is not defensive duplication of an application-level check — it is the check. A handler that forgets to scope produces no rows here rather than another owner's data, and sqlc makes the parameter impossible to omit because the generated signature requires it.
func (*Queries) CreateVolume ¶
Storage attached to an app. Scoped by owner_id like every other resource query: a handler that forgets to scope produces no rows here rather than another team's storage.
func (*Queries) CreateVolumeAndBump ¶
func (q *Queries) CreateVolumeAndBump(ctx context.Context, arg CreateVolumeAndBumpParams) (CreateVolumeAndBumpRow, error)
func (*Queries) DeleteApp ¶
func (q *Queries) DeleteApp(ctx context.Context, arg DeleteAppParams) error
func (*Queries) DeleteAppHook ¶ added in v0.2.0
func (*Queries) DeleteCustomDomain ¶
func (*Queries) DeleteExpiredInvitations ¶
func (*Queries) DeleteExpiredMagicLinks ¶
func (*Queries) DeleteExpiredSessions ¶
func (*Queries) DeleteInvitation ¶
Scoped by owner_id as well as id: an id from another team must not be reachable by someone who happens to administer this one.
func (*Queries) DeleteInvitationsByInviter ¶
func (q *Queries) DeleteInvitationsByInviter(ctx context.Context, arg DeleteInvitationsByInviterParams) error
Withdraws the invitations somebody issued, used when they lose the authority to have issued them. An administrator who leaves must not keep a live token for an address they control.
func (*Queries) DeleteManagedDomain ¶
Releases an app's platform hostname.
Deleting rather than leaving the row is what makes the feature reversible: hostnames are globally unique, so a retired row keeps the name reserved against every other app forever.
func (*Queries) DeleteMembership ¶
func (q *Queries) DeleteMembership(ctx context.Context, arg DeleteMembershipParams) error
func (*Queries) DeleteOtherSessionsForUser ¶
func (q *Queries) DeleteOtherSessionsForUser(ctx context.Context, arg DeleteOtherSessionsForUserParams) error
Ends every session but the one asking.
DeleteSessionsForUser cannot serve here: it takes out the caller's own, so changing a password from the account page would sign the person out of the browser they are looking at, and they would read that as the change having failed rather than having worked. The surviving session is named `keep` rather than `except`, which is a reserved word the query parser will not take as an identifier.
func (*Queries) DeletePassword ¶
execrows so that "there was nothing to remove" is distinguishable from success. Reporting a credential withdrawn when none existed is how somebody stops looking for the one that is still there.
func (*Queries) DeleteProject ¶
func (*Queries) DeleteSessionByHash ¶
func (*Queries) DeleteSessionsForUser ¶
func (*Queries) DeleteVariable ¶
func (*Queries) DeleteVariableAndBump ¶
func (q *Queries) DeleteVariableAndBump(ctx context.Context, arg DeleteVariableAndBumpParams) (DeleteVariableAndBumpRow, error)
func (*Queries) DeleteVolume ¶
func (*Queries) DeleteVolumeAndBump ¶
func (q *Queries) DeleteVolumeAndBump(ctx context.Context, arg DeleteVolumeAndBumpParams) (DeleteVolumeAndBumpRow, error)
func (*Queries) DeployActivity ¶
func (q *Queries) DeployActivity(ctx context.Context, arg DeployActivityParams) ([]DeployActivityRow, error)
Deploys per day and outcome, for the overview chart.
Counted in the database rather than by reading rows and tallying them in Go: a busy month is thousands of deployments, and none of them are wanted here except as a number.
Days with no deploys are absent from this result. The caller fills them in; see app.DeployActivity for why that cannot be skipped.
func (*Queries) FailQueuedBuildOperation ¶
func (*Queries) FinishBuild ¶
func (*Queries) FinishDeployment ¶
func (q *Queries) FinishDeployment(ctx context.Context, arg FinishDeploymentParams) (Deployment, error)
func (*Queries) FinishDeploymentOperation ¶
func (*Queries) GetAppByID ¶
func (*Queries) GetAppForReleaseBackfill ¶
func (*Queries) GetAppHook ¶ added in v0.2.0
func (*Queries) GetAppRelease ¶
func (q *Queries) GetAppRelease(ctx context.Context, arg GetAppReleaseParams) (AppRelease, error)
func (*Queries) GetBuildForDeployment ¶
func (*Queries) GetBuildRecoveryOperation ¶
func (q *Queries) GetBuildRecoveryOperation(ctx context.Context, arg GetBuildRecoveryOperationParams) (DeploymentOperation, error)
func (*Queries) GetClusterJoin ¶
func (q *Queries) GetClusterJoin(ctx context.Context) (ClusterJoin, error)
The join settings are install-wide, so unlike every other query here these take no owner_id. See the 00012 migration for why.
func (*Queries) GetCustomDomain ¶
func (*Queries) GetDeployment ¶
func (q *Queries) GetDeployment(ctx context.Context, arg GetDeploymentParams) (Deployment, error)
func (*Queries) GetDeploymentOperation ¶
func (q *Queries) GetDeploymentOperation(ctx context.Context, arg GetDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) GetDeploymentOperationByDeployment ¶
func (q *Queries) GetDeploymentOperationByDeployment(ctx context.Context, arg GetDeploymentOperationByDeploymentParams) (DeploymentOperation, error)
func (*Queries) GetHookForDelivery ¶ added in v0.2.0
func (q *Queries) GetHookForDelivery(ctx context.Context, appID uuid.UUID) (GetHookForDeliveryRow, error)
By app id alone: a delivery carries no session and no owner. The signature, checked against the secret read here, is what authorises it.
func (*Queries) GetInvitationByHash ¶
func (q *Queries) GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error)
Reads an invitation without spending it, so a signed-out visitor can be sent a sign-in link to the address it names. token_hash is not among the columns, for the same reason it is absent from ListPendingInvitations.
func (*Queries) GetLatestSuccessfulBuildForApp ¶
func (*Queries) GetLiveDeploymentOperationForApp ¶
func (q *Queries) GetLiveDeploymentOperationForApp(ctx context.Context, arg GetLiveDeploymentOperationForAppParams) (DeploymentOperation, error)
The live operation is the only candidate allowed to displace an app's active release. Steady-state convergence must stand down while one exists.
func (*Queries) GetLiveSession ¶
--------------------------------------------------------------------------- Step-up and session revocation --------------------------------------------------------------------------- Reads a session that is still alive, for a caller about to change how the account it belongs to can be signed in to.
GetSession has no expiry filter, so an expired row comes back from it looking valid. GetSessionByHash filters expiry in SQL precisely so that a caller cannot forget, and this is the caller that would: a session that ended an hour ago must not be able to set a password. FOR UPDATE serialises two tabs changing one at the same moment.
Columns are named because the row exists to answer three questions — whose it is, how recently it was proved, whether it is still alive — and starring it would hand the caller a struct that grows every time `sessions` does.
func (*Queries) GetManagedDomain ¶
func (*Queries) GetMembership ¶
func (q *Queries) GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
func (*Queries) GetPasswordByEmail ¶
func (q *Queries) GetPasswordByEmail(ctx context.Context, email string) (GetPasswordByEmailRow, error)
--------------------------------------------------------------------------- Passwords
Every query below either names its columns or returns an id. `secret` appears in two of them — the sign-in lookup and the locking read that a change or a removal goes through — and both row types are consumed inside the account package and never returned from it. That is the whole storage rule, and it is easier to keep by making the leak impossible than by remembering not to write it. Anything added here that does not need the hash must not select it. --------------------------------------------------------------------------- The only query that returns a hash, and the only one that ever should.
The join is INNER, so an unknown address and a known address with no password come back as the same pgx.ErrNoRows. There is no branch in Go that could tell them apart, which is what makes the equal-cost verify in AuthenticatePassword structural rather than something a caller has to remember to write.
The user's columns are named rather than starred, so this cannot quietly start returning whatever is added to `users` next.
func (*Queries) GetPlatformDNS ¶
func (q *Queries) GetPlatformDNS(ctx context.Context) (PlatformDn, error)
Install-wide DNS settings. No owner_id, for the reason cluster_join has none: they configure one controller shared by every team.
func (*Queries) GetPlatformRegistry ¶
func (q *Queries) GetPlatformRegistry(ctx context.Context) (PlatformRegistry, error)
The install's image registry. No owner_id, for the reason platform_dns has none: one registry serves every team's builds.
func (*Queries) GetProjectByID ¶
func (*Queries) GetProjectBySlug ¶
func (*Queries) GetReleaseBackfillState ¶
func (q *Queries) GetReleaseBackfillState(ctx context.Context, arg GetReleaseBackfillStateParams) (AppReleaseBackfill, error)
func (*Queries) GetSession ¶
Expiry is filtered here for the reason GetSessionByHash gives: so that an expired row can never be treated as valid by a caller that forgets to check. This one used to be the caller that forgot. It was not reachable with a dead session — the route gate resolves a live one first — but "not reachable" is a property of today's routing rather than of this query, and the whole point of putting the condition in SQL is that it does not depend on that.
func (*Queries) GetSessionByHash ¶
func (q *Queries) GetSessionByHash(ctx context.Context, tokenHash []byte) (GetSessionByHashRow, error)
The team is joined in because the request that carries this cookie needs the owner it resolves to, and a second round trip per request buys nothing. The join is LEFT: a session whose team was deleted still exists, it just has no owner to act as.
Expiry is filtered in SQL rather than in Go so that an expired row can never be treated as valid by a caller that forgets to check. Resolves a session only while the membership behind it still exists.
The join to memberships is the security boundary, not decoration. Revoking sessions imperatively when someone is removed would work only for the call sites that remember to do it, and would still miss membership lost by cascade. Joining makes a departed member's cookie stop resolving the instant the row goes, by whatever route it went.
INNER JOIN on teams too: a session with no active team resolves to no owner, and returning a row the caller must then remember to reject is how that check gets skipped.
func (*Queries) GetSuccessfulBuildForImage ¶
func (*Queries) GetTeamRow ¶
func (*Queries) GetUserByEmail ¶
func (*Queries) GetUserByID ¶
func (*Queries) GetVariable ¶
func (*Queries) GrowVolume ¶
Expansion only, enforced in the WHERE clause rather than by reading the row and comparing in Go: a check the caller performs is one a caller can skip, and Kubernetes cannot shrink a claim afterwards to undo it.
func (*Queries) GrowVolumeAndBump ¶
func (q *Queries) GrowVolumeAndBump(ctx context.Context, arg GrowVolumeAndBumpParams) (GrowVolumeAndBumpRow, error)
func (*Queries) HasPassword ¶
func (*Queries) HasVerifiedDomainsForApp ¶
func (*Queries) IncrementAppConfigVersion ¶
func (*Queries) IncrementCNAMEAppConfigVersions ¶
The platform CNAME target is an install-wide live overlay, but it only renders into apps that explicitly opted into CNAME routing.
func (*Queries) IncrementGitAppConfigVersions ¶
Registry credentials are a live overlay for every Git-built image. They are install-wide, so one settings mutation invalidates each Git app exactly once without manufacturing release history.
func (*Queries) ListAdmissiblePushes ¶ added in v0.2.0
func (q *Queries) ListAdmissiblePushes(ctx context.Context, resultLimit int32) ([]ListAdmissiblePushesRow, error)
Pushes waiting behind a deploy that has since ended. An app whose deploy is still live is left out, rather than tried and refused every half second.
func (*Queries) ListAppLinks ¶
func (*Queries) ListAppReleases ¶
func (q *Queries) ListAppReleases(ctx context.Context, arg ListAppReleasesParams) ([]AppRelease, error)
func (*Queries) ListAppsForReconciliation ¶
Apps whose database pointer names the workload the cluster must converge to. This is intentionally install-scoped: the reconciler acts from stored ownership rather than from an authenticated request.
func (*Queries) ListAppsInProject ¶
func (*Queries) ListAppsWithLastDeploy ¶
func (q *Queries) ListAppsWithLastDeploy(ctx context.Context, ownerID string) ([]ListAppsWithLastDeployRow, error)
Every app, with how its most recent deployment ended.
A failed deploy leaves the previous workload running, so the app's live status stays green and nothing in a list of apps says the last attempt to change it did not take. That is exactly the deploy somebody needs to find, and until this query existed the only way to find it was to open each app.
LATERAL rather than a window function or a join on max(started_at): one index lookup per app, and it reads as what it is — the latest row for this app.
func (*Queries) ListAppsWithoutProject ¶
Apps that predate projects, or whose project was deleted.
Returned separately rather than folded into a default project by the query, because assigning one is a write and a read should not have side effects that a caller cannot see.
func (*Queries) ListCustomDomains ¶
func (*Queries) ListCustomDomainsForOwner ¶
func (q *Queries) ListCustomDomainsForOwner(ctx context.Context, ownerID string) ([]ListCustomDomainsForOwnerRow, error)
Every custom domain on the install, worst first.
Nothing answered "which domains are stuck" before this. A domain that is not routed is the only kind anybody needs to find, so it sorts to the top.
func (*Queries) ListDeploymentOperations ¶
func (q *Queries) ListDeploymentOperations(ctx context.Context, arg ListDeploymentOperationsParams) ([]DeploymentOperation, error)
func (*Queries) ListDeployments ¶
func (q *Queries) ListDeployments(ctx context.Context, arg ListDeploymentsParams) ([]Deployment, error)
func (*Queries) ListDomainsByApp ¶
func (*Queries) ListMembersOfTeam ¶
func (*Queries) ListMembershipsForUser ¶
func (*Queries) ListPendingInvitations ¶
func (q *Queries) ListPendingInvitations(ctx context.Context, ownerID string) ([]ListPendingInvitationsRow, error)
The columns are named rather than starred, and token_hash is not among them. This list feeds the team page, and a hash that never leaves the database cannot be rendered into it by a template that innocently prints a struct.
func (*Queries) ListPendingReleaseBackfills ¶
func (*Queries) ListProjects ¶
func (*Queries) ListRecentDeployments ¶
func (q *Queries) ListRecentDeployments(ctx context.Context, arg ListRecentDeploymentsParams) ([]ListRecentDeploymentsRow, error)
Joined to apps so the activity feed can name the workload without a second round trip per row. The join is on app_id AND owner_id: joining on app_id alone would be correct today and wrong the moment more than one owner exists.
func (*Queries) ListRunningBuilds ¶
Every build still claiming to run, oldest first. Not owner-scoped: this feeds the reconciler, which is the platform settling its own records rather than a team reading theirs.
func (*Queries) ListVariablesForApp ¶
func (*Queries) ListVolumesForApp ¶
func (*Queries) LockDeploymentAdmission ¶
Claim counting and selection must share this transaction-wide lock. Row locks alone protect candidates, not the cluster-wide count: two connections can otherwise lock different rows after both observed one free build slot.
func (*Queries) LockPassword ¶
Reads and locks the person's password, for a caller inside a transaction that is about to replace or remove it.
Returns the secret as well as the id because one row answers two questions the caller needs at the same moment: whether this is an add or a replace, since only a replace revokes the person's other sessions, and whether a current password offered as proof of recent authentication is the right one. Asking twice would be two round trips and one more chance for the second to read a different row than the first.
FOR UPDATE is what serialises two tabs. Read outside the transaction this would be check-then-act: both see no password, both insert, one upserts over the other, and neither revokes.
func (*Queries) LockTeam ¶
A role change reads the owner count and then writes; taking the team row first serialises those pairs, so two concurrent demotions cannot both see two owners and both proceed.
func (*Queries) MarkDomainRouted ¶
Moves a proven domain to routed, once the Ingress actually carries it.
Guarded on the state it is coming from, so a check that has since found drift is not overwritten by an apply that started before it.
func (*Queries) MarkHookPending ¶ added in v0.2.0
func (q *Queries) MarkHookPending(ctx context.Context, arg MarkHookPendingParams) error
func (*Queries) MarkVerifiedDomainsRoutedForApp ¶
func (q *Queries) MarkVerifiedDomainsRoutedForApp(ctx context.Context, arg MarkVerifiedDomainsRoutedForAppParams) (int64, error)
A verified domain becomes routed only after the app reconciler has observed or produced the matching workload convergence key. This app-scoped form closes the asynchronous handoff from the DNS checker.
func (*Queries) MoveAppsWithoutProject ¶
func (*Queries) NormalizeLegacyDeploymentStatuses ¶
func (*Queries) ReclaimExpiredDeploymentOperations ¶
func (q *Queries) ReclaimExpiredDeploymentOperations(ctx context.Context) ([]DeploymentOperation, error)
func (*Queries) RecordDomainCheck ¶
func (q *Queries) RecordDomainCheck(ctx context.Context, arg RecordDomainCheckParams) (int64, error)
Records what a check saw.
Not scoped by owner, and deliberately: the background checker works through every install's rows by id, having already claimed them below. Owner scoping protects a request that names a row; this is not one. Every path that reaches here from a request goes through GetCustomDomain first, which is scoped.
The schedule arrives already computed rather than being worked out in SQL, so the backoff can be tested against an injected clock instead of against now().
func (*Queries) RecordHookDelivery ¶ added in v0.2.0
func (q *Queries) RecordHookDelivery(ctx context.Context, arg RecordHookDeliveryParams) error
func (*Queries) RecoverBuiltDeploymentOperation ¶
func (q *Queries) RecoverBuiltDeploymentOperation(ctx context.Context, arg RecoverBuiltDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) ReleaseRecoverableDeploymentOperation ¶
func (q *Queries) ReleaseRecoverableDeploymentOperation(ctx context.Context, arg ReleaseRecoverableDeploymentOperationParams) (int64, error)
A cluster outage is not a deployment failure. Give observation recovery back to the queue without changing its checkpoint or verification budget.
func (*Queries) RenameProject ¶
func (*Queries) RenewDeploymentOperationLease ¶
func (*Queries) ReplaceAppLinks ¶
func (q *Queries) ReplaceAppLinks(ctx context.Context, arg ReplaceAppLinksParams) error
func (*Queries) RequestDomainCheck ¶
func (q *Queries) RequestDomainCheck(ctx context.Context, arg RequestDomainCheckParams) (int64, error)
Brings a domain's next check forward. What the "Check now" button does.
It resets the attempt count as well, because somebody pressing it is telling us the situation changed — and a domain that had backed off to a fifteen minute interval should not go straight back to one.
func (*Queries) RestoreAppFromRelease ¶
func (q *Queries) RestoreAppFromRelease(ctx context.Context, arg RestoreAppFromReleaseParams) (App, error)
Rollback makes the app's desired state the release's again, so the next edit builds on what is running rather than quietly rolling forward to what was replaced. Only release-owned fields: hostnames, networking, storage and the repository are current state and stay as they are. The uid is a build's discovery for a Git app, and belongs to the image being restored.
func (*Queries) RoutableHostsForApp ¶
Hostnames that may actually be routed to.
A managed host is routable because the platform issued it; a custom one only once it is proven. This is the query the Ingress is built from, so the gate lives here rather than in a caller that might forget it.
func (*Queries) SetActiveRelease ¶
func (*Queries) SetAppHealth ¶
func (*Queries) SetAppImage ¶
The image a build produced. Separate from UpdateApp because a build sets only this: the replicas and limits a person configured are not a build's to overwrite, and passing them through would make every build a chance to.
func (*Queries) SetAppNetworking ¶
func (*Queries) SetAppPosition ¶
func (*Queries) SetAppProject ¶
func (*Queries) SetAppReplicas ¶
func (*Queries) SetAppRunAsUser ¶
func (q *Queries) SetAppRunAsUser(ctx context.Context, arg SetAppRunAsUserParams) error
Recorded by a build, which is the only thing that can discover it. The image update owns the build operation's single config_version increment.
func (*Queries) SetBuildJob ¶
func (q *Queries) SetBuildJob(ctx context.Context, arg SetBuildJobParams) error
func (*Queries) SetClaimedOperationRelease ¶
func (*Queries) SetClusterJoin ¶
func (q *Queries) SetClusterJoin(ctx context.Context, arg SetClusterJoinParams) (ClusterJoin, error)
func (*Queries) SetDeploymentRelease ¶
func (*Queries) SetPlatformDNS ¶
func (q *Queries) SetPlatformDNS(ctx context.Context, arg SetPlatformDNSParams) (PlatformDn, error)
func (*Queries) SetPlatformRegistry ¶
func (q *Queries) SetPlatformRegistry(ctx context.Context, arg SetPlatformRegistryParams) (PlatformRegistry, error)
func (*Queries) SetReleaseBackfillState ¶
func (*Queries) SetSessionTeam ¶
func (q *Queries) SetSessionTeam(ctx context.Context, arg SetSessionTeamParams) error
func (*Queries) TakeHookPending ¶ added in v0.2.0
Cleared in the same transaction that admits the deploy, so a push is either still waiting or has a deployment — never neither.
func (*Queries) TouchSessionAuthentication ¶
Opens the step-up window. Scoped by expiry so an expired session cannot be revived into a recently-authenticated one; execrows so the caller can tell that it was not.
func (*Queries) TransitionDeploymentOperation ¶
func (q *Queries) TransitionDeploymentOperation(ctx context.Context, arg TransitionDeploymentOperationParams) (DeploymentOperation, error)
func (*Queries) UpdateApp ¶
Everything about an app a person is allowed to change after creating it.
Deliberately not replicas: scaling has its own query because it has its own rule about storage, and folding it in here would make every settings save a chance to silently reset a scale somebody had chosen.
Nor the health probe, the networking toggles or run_as_user — each of those already has a query shaped to what it means, and this one exists for the fields that had no way to be changed at all.
func (*Queries) UpdatePasswordSecret ¶
func (q *Queries) UpdatePasswordSecret(ctx context.Context, arg UpdatePasswordSecretParams) (int64, error)
Rehash-on-login, for a stored hash made at a cost this build has moved past. Best effort and never on the critical path: the sign-in has already succeeded by the time this runs.
Conditional on the old value, which makes it a compare-and-swap. Between the verify and this update the person may have changed their password in another tab; without the condition, the rehash of the OLD password would overwrite the new one and lock them out of an account they had just secured. With it, a stale rehash matches no rows and nothing happens.
func (*Queries) UpsertAppHook ¶ added in v0.2.0
Deploy-on-push webhooks. See migration 00028. A new secret replaces the old one outright, so regenerating is also how a leaked secret is revoked.
func (*Queries) UpsertInvitation ¶
func (q *Queries) UpsertInvitation(ctx context.Context, arg UpsertInvitationParams) (uuid.UUID, error)
Re-inviting replaces the pending invitation rather than adding a second one, so the token in the older mail stops working. Two live tokens for one address would mean revoking the invitation on screen leaves the other one usable.
func (*Queries) UpsertManagedDomain ¶
func (q *Queries) UpsertManagedDomain(ctx context.Context, arg UpsertManagedDomainParams) (Domain, error)
Platform-issued hostnames. Custom domains get their own queries when that sub-project lands; keeping them in one file rather than in apps.sql is so that apps.sql stays about apps. Issues or reissues the platform hostname for an app.
The conflict target is the partial index, so a second call for the same app moves its hostname rather than adding one. A collision on the global host index is a different conflict and is deliberately left to raise, because two apps claiming one hostname is a real error, not something to paper over.
The state is 'routed' because a name the platform issued needs no proof of ownership; requiring proof would mean inventing a verification step for a name we already control. verified follows from it and is not written here — it is generated from state, so that the routing gate and the state on screen cannot disagree.
func (*Queries) UpsertMembership ¶
func (q *Queries) UpsertMembership(ctx context.Context, arg UpsertMembershipParams) (Membership, error)
func (*Queries) UpsertPassword ¶
Returns an id and not the row. RETURNING * here would put the hash into a Go struct for no reason at all, which is the shortest route to it being logged.
func (*Queries) UpsertUser ¶
Users, sessions and credentials carry no owner_id: a person exists before they belong to any team, and what proves who they are is not a fact about a tenant. Memberships and invitations do, and stay scoped by it like everything else.
func (*Queries) UpsertVariable ¶
Environment variables, one row each so a secret can be sealed while its neighbour stays readable. Upsert rather than insert: setting a variable that already exists is what a person means by editing one, and a separate update path would need the caller to know which case they are in.
func (*Queries) UpsertVariableAndBump ¶
func (q *Queries) UpsertVariableAndBump(ctx context.Context, arg UpsertVariableAndBumpParams) (UpsertVariableAndBumpRow, error)