Files
lincodex/backend/internal/adapter/secondary/postgres/sqlc/querier.go
T

1106 lines
86 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package sqlc
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
type Querier interface {
// Adds recipients to the day and the month row. The caller holds their
// locks from LockMailQuotaRows and has checked both limits.
AddMailQuotaUsage(ctx context.Context, arg AddMailQuotaUsageParams) (int64, error)
// Saving a profile advances onboarding only from that exact step. A retry or
// a save after a later step is already stored never regresses onboarding.
AdvanceCandidateOnboardingAfterProfile(ctx context.Context, arg AdvanceCandidateOnboardingAfterProfileParams) error
// A questionnaire save advances onboarding only from its own step.
AdvanceCandidateOnboardingAfterQuestionnaire(ctx context.Context, arg AdvanceCandidateOnboardingAfterQuestionnaireParams) error
// Advances the version over the one the caller read, in the same statement.
// The row lock it takes serializes concurrent saves of one profile. The update
// time never moves back: an application clock behind the stored time (clock
// skew between instances) keeps the stored time, which the CHECK
// candidate_profiles_updated_after_creation also requires. No row
// returns for a stale version or for an account without a profile, which the
// caller answers as a version conflict.
AdvanceCandidateProfileVersion(ctx context.Context, arg AdvanceCandidateProfileVersionParams) (CandidateProfile, error)
// Advances an existing questionnaire only at the version read by the caller.
// The row lock serializes saves for one user; a stale writer returns no row.
AdvanceCandidateQuestionnaireVersion(ctx context.Context, arg AdvanceCandidateQuestionnaireVersionParams) (CandidateQuestionnaire, error)
// The conditional update is the compare-and-swap of a draft: it applies only
// to a draft whose version is still the one the caller read, and advances the
// version by one. No row is returned when it lost a race or the invitation
// left the draft state.
AdvanceInvitationDraft(ctx context.Context, arg AdvanceInvitationDraftParams) (pgtype.UUID, error)
// The conditional parent update is the compare-and-swap. Appending the
// snapshot is part of the same SQL statement, so a failed insert leaves the
// parent pointer unchanged even before the surrounding transaction rolls
// back. No row is returned when the expected version lost a race.
AdvanceOrganizationNeed(ctx context.Context, arg AdvanceOrganizationNeedParams) (string, error)
// Starts a new registration of an unverified account without touching its
// credentials, scenario, or onboarding step: the new registration carries
// them on its verification token. Advances the registration version, which
// ends every earlier token, and deletes the registration C1 of the earlier
// registrant like UpdateUserRegistration does.
AdvanceUserRegistration(ctx context.Context, arg AdvanceUserRegistrationParams) (AdvanceUserRegistrationRow, error)
// Every changed version appends exactly one private snapshot. The unique
// key prevents a second snapshot for the same profile version.
AppendCandidateProfileHistory(ctx context.Context, arg AppendCandidateProfileHistoryParams) error
// Authorizes one retry of a terminal unknown delivery. The update and append-
// only decision share one statement and lock the current row, so a second or
// concurrent operator decision cannot schedule another send for the same
// unknown attempt. The provider account must still match the delivery's pin.
AuthorizeUnknownDeliveryRetry(ctx context.Context, arg AuthorizeUnknownDeliveryRetryParams) (int64, error)
// Cancels a job that has not finished. A job whose handler transaction is
// in progress holds its row lock, so the statement waits for it: after the
// handler committed the job is done and nothing is canceled; otherwise the
// worker finds its lease gone and does not run or complete the job.
CancelScheduledJob(ctx context.Context, arg CancelScheduledJobParams) (int64, error)
// Ends a claimed delivery whose stored content no longer matches its hash, so
// one broken row never blocks the delivery queue. It matches only a delivery
// that the worker could still send, ends the lease, advances the version, and
// redacts the bodies of a token mail like any other cancellation. now is the
// application clock.
CancelUnreadableDelivery(ctx context.Context, arg CancelUnreadableDeliveryParams) (int64, error)
// The candidate may name an organization in privacy settings only if that
// organization already appears in their own access history or is already
// hidden. Unknown and unseen organizations produce the same no-row result.
CandidateCanSeeOrganization(ctx context.Context, arg CandidateCanSeeOrganizationParams) (CandidateCanSeeOrganizationRow, error)
// Claims the most overdue delivery that the sending worker may send, in one
// statement: a pending, waiting_quota, or scheduled unknown delivery of the service mail kinds
// (the literals match the predicate of deliveries_due_idx, so an idle poll
// reads only that small index) whose next_attempt_at has passed, pinned to the
// configured provider account (or to rebind_provider before its first
// attempt, which the worker moves to the configured account), and held by no
// live lease. A row that another worker locks is skipped without waiting, so
// several processes never take the same delivery, and a delivery whose lease
// expired, because its worker stopped, is claimed again.
// The lease is measured by the database clock, never by the clock of an
// application instance: it lasts lease_seconds from clock_timestamp(), and a
// lease is live while claimed_until is later than clock_timestamp(). Due times
// stay on the application clock that wrote them. Neither the version nor
// updated_at changes: a claim is not a change of the delivery.
// previous_claimed_until is the deadline of an abandoned lease, NULL for a
// delivery nobody held; since_first_send_seconds always measures from the
// original first request by the database clock, and is -1 when none started.
// manual_retry_pending is true until the first provider call of the latest
// manual authorization starts. send_start_unsettled means a provider call
// started at the current attempt_count but no result was recorded afterward.
// has_uncertain_attempt keeps an earlier unknown result visible even if a
// later confirmed refusal moved the current delivery back to pending.
// now is the application clock. Unknown deliveries without a scheduled retry
// and quota waits with an unknown reset wait for an operator.
ClaimDueDelivery(ctx context.Context, arg ClaimDueDeliveryParams) (ClaimDueDeliveryRow, error)
// Claims up to batch_limit jobs of the listed kinds in one statement: jobs
// whose available_at has passed, and running jobs whose lease expired
// because their worker stopped without finishing them. Rows that another
// worker locks are skipped without waiting. Each claimed job gets the lease
// of lease_owner and one more attempt, except a job whose expired attempt
// never started its handler: that attempt is reused, so a worker that was
// busy with other jobs of its batch costs the job nothing. A job whose
// started attempt was abandoned on its last allowed attempt becomes dead
// with lease_expired instead, so a job that keeps crashing its worker
// stops. now is the application clock.
//
// The kind filter applies after the index on available_at; when many waiting
// jobs belong to kinds without a handler in the claiming process, an index
// on (kind, available_at, id) is the next step.
ClaimScheduledJobs(ctx context.Context, arg ClaimScheduledJobsParams) ([]ClaimScheduledJobsRow, error)
// Completes a job in the transaction of its handler effect. The guard is
// the lease owner and the attempt, so a worker that lost its lease cannot
// complete the job.
CompleteScheduledJob(ctx context.Context, arg CompleteScheduledJobParams) (int64, error)
// Applies the registration carried by its token and verifies the address in
// one optimistic update. The caller holds the token lock and checks the
// matching C1 in the same transaction.
ConfirmUserEmail(ctx context.Context, arg ConfirmUserEmailParams) (User, error)
// Consumes a token in one statement. Concurrent callers queue on the token
// row lock; under READ COMMITTED each waiter re-checks the WHERE clause
// against the committed row, so exactly one of them updates it. The join
// compares the registration version with the account row as the statement
// reads it, without locking that row, so it rejects a token from an earlier
// registration that already committed but not one that commits afterwards.
// The confirmation guarantee therefore needs MarkUserEmailVerified with the
// returned registration version in the same transaction, rolled back when it
// matches no row.
ConsumeEmailToken(ctx context.Context, arg ConsumeEmailTokenParams) (ConsumeEmailTokenRow, error)
// Count events only for the already owner-locked attempt.
CountAssessmentSignalEvents(ctx context.Context, attemptID pgtype.UUID) (int64, error)
// Counts the hiding records of one candidate for the settings read.
CountCandidateHiddenOrganizations(ctx context.Context, userID pgtype.UUID) (int64, error)
CountCompanyCardViewQuotaWindow(ctx context.Context, arg CountCompanyCardViewQuotaWindowParams) (CountCompanyCardViewQuotaWindowRow, error)
CountCompanyInvitationQuotaWindow(ctx context.Context, arg CountCompanyInvitationQuotaWindowParams) (CountCompanyInvitationQuotaWindowRow, error)
// Counts the families of a category that have at least one published
// version, however many versions each has.
CountPublishedAssessmentFamilies(ctx context.Context, category string) (int32, error)
// Reads that only the match search needs. The visibility of the candidates and
// their permitted evidence come from the card and evidence queries, which are
// the single copy of those barriers; this file adds no candidate-facing read.
// The number of candidates who hold each given category from a source that is
// not a synthetic demonstration, which is the size of the comparable real
// cohort that a percentile needs. It returns counts only, for the pairs the
// caller passes as "specialization/grade", and no row for a pair nobody holds.
CountRealComparableCategories(ctx context.Context, categories []string) ([]CountRealComparableCategoriesRow, error)
// New outcomes share the generic idempotency row and are counted for the
// attempt's rolling receipt window. Replays bypass this query in the usecase.
CountRecentAssessmentSignalOutcomes(ctx context.Context, arg CountRecentAssessmentSignalOutcomesParams) (CountRecentAssessmentSignalOutcomesRow, error)
// Counts root attempts only; the caller applies the effective policy's
// configured window and the product's approved accounting scope.
CountRootAssessmentAttemptsSince(ctx context.Context, arg CountRootAssessmentAttemptsSinceParams) (int64, error)
// The strict lower boundary means an event exactly one window old no longer
// counts. The use case derives Retry-After from first_in_window.
CountSupportCaseRequestEvents(ctx context.Context, arg CountSupportCaseRequestEventsParams) (CountSupportCaseRequestEventsRow, error)
// Creates one durable deletion request per subject until a worker completes it.
// The caller appends the matching outbox intent in the same transaction only
// when this insert returns a row.
CreateAccountDeletionRequest(ctx context.Context, arg CreateAccountDeletionRequestParams) (CreateAccountDeletionRequestRow, error)
// The compare-and-swap of a decline: it applies only to an answerable
// invitation at the version the caller read and before its deadline.
DeclineInvitation(ctx context.Context, arg DeclineInvitationParams) (pgtype.UUID, error)
// A newly reserved generic idempotency window can replace an expired typed
// outcome before the new immutable response is inserted.
DeleteAssessmentAttemptIdempotencyOutcome(ctx context.Context, scopeHash []byte) error
// Lifts one hiding. No row returns when the organization was not hidden, so
// the caller writes the history event only for a real deletion and answers
// 204 either way.
DeleteCandidateHiddenOrganization(ctx context.Context, arg DeleteCandidateHiddenOrganizationParams) (pgtype.UUID, error)
// Removes the claims that a save replaces. The adapter calls it after the
// version advanced and before it inserts the new set, in one transaction.
DeleteCandidateProfileClaims(ctx context.Context, userID pgtype.UUID) error
// Replaces the current explicit decisions with those in the new profile.
// The versioned profile row is advanced first in this same transaction.
DeleteCandidateProfileOverlapConfirmations(ctx context.Context, userID pgtype.UUID) error
// Replaces all specialization answers after the version row advanced in the
// same transaction.
DeleteCandidateQuestionnaireSpecializations(ctx context.Context, userID pgtype.UUID) error
// The generic reservation has already established that a previous outcome is
// expired before this child is removed and replaced in the same transaction.
DeleteExpiredAssessmentSignalOutcome(ctx context.Context, scopeHash []byte) error
DeleteExpiredCompanyCardViewQuotaUsage(ctx context.Context, arg DeleteExpiredCompanyCardViewQuotaUsageParams) (int64, error)
DeleteMailRequest(ctx context.Context, id pgtype.UUID) (int64, error)
DeleteOrganizationRepresentatives(ctx context.Context, organizationID pgtype.UUID) error
// No raw Idempotency-Key or request body reaches these statements. Failure
// responses pass {} as case_snapshot and the CASE stores SQL NULL instead.
DeleteSupportCaseCreateOutcome(ctx context.Context, scopeHash []byte) error
// Deletes one batch of accounts that stayed unverified since before cutoff,
// oldest first, with their tokens, sessions, mail requests, mail deliveries
// (and through the deliveries their attempts), and consent records. The
// consent records reference the account with ON DELETE RESTRICT, so they are
// deleted explicitly in the same statement: a registration never confirmed
// by its email owner is not kept as consent evidence. Every lock is taken
// with SKIP LOCKED, so the statement never waits: an account whose row is
// locked, for example by a re-registration, a token insert, a delivery
// insert, or a consent insert, is skipped, and so is an account with any
// token, session, mail request, delivery, or consent row locked, for example
// by a confirmation that consumed a token, the delivery consumer, or a
// worker recording an attempt. Skipped accounts stay for the next run.
// Taking the account lock before the token locks is the reverse of the
// documented order, which is safe only because no lock here waits.
// An account qualifies only when every token, session, mail request,
// delivery, and consent row visible to the statement was locked above.
// The restricting foreign key is checked at the end of the statement, after
// these rows are gone.
DeleteUnverifiedUsersRegisteredBefore(ctx context.Context, arg DeleteUnverifiedUsersRegisteredBeforeParams) (int64, error)
// The conditional update is the compare-and-swap of a send: it applies only to
// a draft whose version is still the one the caller read, records the first
// delivery with its deadline, and advances the version by one. No row is
// returned when it lost a race or the invitation is no longer a draft.
DeliverInvitation(ctx context.Context, arg DeliverInvitationParams) (pgtype.UUID, error)
// Lock order. Every transaction that writes mail_quota_usage first creates
// and locks all the usage rows it will touch with EnsureMailQuotaRows and
// LockMailQuotaRows, which both work in (period_kind, period_start) order,
// and only then writes them or a mail_quota_reservations row. Later UPDATE
// statements of the same transaction find their rows locked already, so the
// scan order of an UPDATE never decides the lock order.
// Creates the listed window rows of a provider account with no usage when
// they do not exist yet, in (period_kind, period_start) order. A window key
// is "<period_kind>/<YYYY-MM-DD>". A concurrent insert of the same row waits
// for the first transaction and then inserts nothing. Existing rows are
// neither changed nor locked here.
EnsureMailQuotaRows(ctx context.Context, arg EnsureMailQuotaRowsParams) error
// Records a failed attempt after its handler transaction rolled back: the
// job waits for its retry at retry_at (status failed) or is dead, with a
// NULL retry_at. due_at keeps the deadline. The same guard as the
// completion applies.
FailScheduledJob(ctx context.Context, arg FailScheduledJobParams) (int64, error)
FindCompanyCardViewQuotaUsage(ctx context.Context, arg FindCompanyCardViewQuotaUsageParams) (pgtype.Timestamptz, error)
FindCompanyInvitationQuotaUsage(ctx context.Context, arg FindCompanyInvitationQuotaUsageParams) (pgtype.UUID, error)
// Returns the newest open reservation of a delivery under a provider account
// made at or after reserved_since. A retry of the delivery inside the
// provider's idempotency window reuses it instead of counting again.
FindOpenMailQuotaReservation(ctx context.Context, arg FindOpenMailQuotaReservationParams) (FindOpenMailQuotaReservationRow, error)
// Reads the durable active deletion request when an earlier request already
// exists. A completed request does not suppress a later explicit request.
GetActiveAccountDeletionRequest(ctx context.Context, subjectID pgtype.UUID) (GetActiveAccountDeletionRequestRow, error)
// Locks the active real attempt after LockAssessmentAttemptScope.
GetActiveAssessmentAttemptForSpecialization(ctx context.Context, arg GetActiveAssessmentAttemptForSpecializationParams) (AssessmentAttempt, error)
GetActiveSessionByTokenHash(ctx context.Context, arg GetActiveSessionByTokenHashParams) (Session, error)
// Locks the one active express attempt after LockAssessmentAttemptScope.
GetActiveTrainingAssessmentAttempt(ctx context.Context, userID pgtype.UUID) (AssessmentAttempt, error)
// Returns a full private attempt only to its candidate.
GetAssessmentAttemptForCandidate(ctx context.Context, arg GetAssessmentAttemptForCandidateParams) (AssessmentAttempt, error)
GetAssessmentAttemptIdempotencyOutcome(ctx context.Context, scopeHash []byte) (GetAssessmentAttemptIdempotencyOutcomeRow, error)
// Reads the immutable attempt kind without locking the row. Session commands
// use this only to decide whether C3 applies before acquiring the row lock.
GetAssessmentAttemptKindForCandidate(ctx context.Context, arg GetAssessmentAttemptKindForCandidateParams) (string, error)
// Reads a result only for the owning candidate.
GetAssessmentAttemptResult(ctx context.Context, arg GetAssessmentAttemptResultParams) (string, error)
// Returns both immutable result versions. NULL category fields identify a
// legacy v1 record and must not be reconstructed from current state.
GetAssessmentAttemptResultHistoryEntry(ctx context.Context, arg GetAssessmentAttemptResultHistoryEntryParams) (GetAssessmentAttemptResultHistoryEntryRow, error)
GetAssessmentAttemptReview(ctx context.Context, attemptID pgtype.UUID) (GetAssessmentAttemptReviewRow, error)
// Reads an active real attempt without taking the write lock used by create.
// The availability GET never expires or otherwise mutates this row.
GetAssessmentAvailabilityActiveAttempt(ctx context.Context, arg GetAssessmentAvailabilityActiveAttemptParams) (GetAssessmentAvailabilityActiveAttemptRow, error)
GetAssessmentClientSignalTotals(ctx context.Context, attemptID pgtype.UUID) (GetAssessmentClientSignalTotalsRow, error)
GetAssessmentFamilyByID(ctx context.Context, id pgtype.UUID) (AssessmentFamily, error)
GetAssessmentFamilyVersion(ctx context.Context, arg GetAssessmentFamilyVersionParams) (AssessmentFamily, error)
// The attempt a review job works on: real attempts only.
GetAssessmentReviewSubject(ctx context.Context, attemptID pgtype.UUID) (pgtype.UUID, error)
// Counts eligible root attempts in a policy window and computes the instant
// at which one additional root slot opens. The microsecond adjustment matches
// the creation predicate created_at >= since at PostgreSQL timestamp precision.
GetAssessmentRootQuotaAvailability(ctx context.Context, arg GetAssessmentRootQuotaAvailabilityParams) (GetAssessmentRootQuotaAvailabilityRow, error)
// The caller has already checked that the user is a candidate. A missing row
// means the notice version was not acknowledged.
GetAssessmentSignalNoticeAcknowledgement(ctx context.Context, arg GetAssessmentSignalNoticeAcknowledgementParams) (pgtype.Timestamptz, error)
// Read only the receipt associated with the reserved idempotency scope.
GetAssessmentSignalOutcome(ctx context.Context, scopeHash []byte) (GetAssessmentSignalOutcomeRow, error)
GetCandidateAssessmentCategory(ctx context.Context, arg GetCandidateAssessmentCategoryParams) (CandidateAssessmentCategory, error)
// Reads one hiding of the candidate with the current name of the
// organization.
GetCandidateHiddenOrganization(ctx context.Context, arg GetCandidateHiddenOrganizationParams) (GetCandidateHiddenOrganizationRow, error)
GetConsentText(ctx context.Context, arg GetConsentTextParams) (ConsentText, error)
GetContactConsentRecordByInvitation(ctx context.Context, arg GetContactConsentRecordByInvitationParams) (GetContactConsentRecordByInvitationRow, error)
GetCurrentAssessmentCategoryOpening(ctx context.Context, category string) (AssessmentCategoryOpening, error)
// The newest unrevoked record of a purpose other than C4.
GetCurrentConsentRecord(ctx context.Context, arg GetCurrentConsentRecordParams) (GetCurrentConsentRecordRow, error)
// The text of a purpose that applies at a time: the latest publication not
// after it.
GetCurrentConsentText(ctx context.Context, arg GetCurrentConsentTextParams) (ConsentText, error)
// The database clock, which stamps the effective time of a policy version, so
// "the version in force now" is judged against the same clock.
GetDatabaseTime(ctx context.Context) (pgtype.Timestamptz, error)
GetDeliveryByID(ctx context.Context, id pgtype.UUID) (GetDeliveryByIDRow, error)
// Reads only the metadata needed by the local operator retry interface. It
// intentionally does not select the address, token, subject, or message body.
GetDeliveryRetrySnapshot(ctx context.Context, id pgtype.UUID) (GetDeliveryRetrySnapshotRow, error)
// Aggregates the deliveries by kind and status for the metrics, at most once
// per metrics interval. It reads only kind, status, and next_attempt_at,
// never an address, a body, or an ID. No index covers status, so it scans
// the table; add an index on (status) or keep per-status counters before
// the table holds millions of rows.
GetDeliveryStatistics(ctx context.Context) ([]GetDeliveryStatisticsRow, error)
// Among the versions of a family already effective at a time, the newest
// publication wins. A version scheduled for later therefore never undoes a
// version published after it. The unique (policy_key, version) index serves
// the backward scan.
GetEffectivePolicyVersion(ctx context.Context, arg GetEffectivePolicyVersionParams) (PolicyVersion, error)
// Reads a token before password verification; Consume rechecks it in the
// confirmation transaction and clears pending credentials when it succeeds.
GetEmailTokenByHash(ctx context.Context, arg GetEmailTokenByHashParams) (EmailToken, error)
// Explains why ConsumeEmailToken matched no row.
GetEmailTokenState(ctx context.Context, arg GetEmailTokenStateParams) (GetEmailTokenStateRow, error)
GetInvitationCreationResult(ctx context.Context, scopeHash []byte) (string, error)
GetInvitationDeclineResult(ctx context.Context, scopeHash []byte) (GetInvitationDeclineResultRow, error)
GetInvitationSendResult(ctx context.Context, scopeHash []byte) (GetInvitationSendResultRow, error)
// The caller holds the attempt row lock, so the last mark is stable.
GetLastAssessmentOriginMark(ctx context.Context, attemptID pgtype.UUID) (AssessmentAttemptOriginMark, error)
GetLatestAssessmentFamily(ctx context.Context, familyKey string) (AssessmentFamily, error)
// Reads the status of the newest delivery of a kind addressed to an account,
// for the account's own view of its mail. It selects no address and no
// content. The recipient index narrows the scan to the account's rows.
GetLatestDeliveryStatus(ctx context.Context, arg GetLatestDeliveryStatusParams) (GetLatestDeliveryStatusRow, error)
// The pending credentials of the newest token of a registration, for a
// resend, which issues its token with the same credentials.
GetLatestPendingRegistration(ctx context.Context, arg GetLatestPendingRegistrationParams) (GetLatestPendingRegistrationRow, error)
GetLatestPolicyVersion(ctx context.Context, policyKey string) (PolicyVersion, error)
// Reads the latest root in a specialization, optionally restricted to grade.
GetLatestRootAssessmentAttempt(ctx context.Context, arg GetLatestRootAssessmentAttemptParams) (AssessmentAttempt, error)
GetLiveIdempotencyRecord(ctx context.Context, arg GetLiveIdempotencyRecordParams) (IdempotencyRecord, error)
// Reads the usage of the day and the month window without locking.
GetMailQuotaUsage(ctx context.Context, arg GetMailQuotaUsageParams) ([]GetMailQuotaUsageRow, error)
// Reads the membership of one account in one organization, in any state.
GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
// Read the existing row after a duplicate insert so the repository can reject
// an event ID whose immutable metadata changed on redelivery.
GetNotificationInboxEvent(ctx context.Context, arg GetNotificationInboxEventParams) (NotificationInboxEvent, error)
// Resolve the sender organization of a synthetic notice under the recipient's
// current standing, so the notice never outlives that standing. A candidate
// sees the name only while the organization is not hidden from them; an
// employer sees it only while they are an active member. No row means the
// content is no longer visible to this recipient.
GetNotificationOrganizationNameForRecipient(ctx context.Context, arg GetNotificationOrganizationNameForRecipientParams) (string, error)
// Reads only the historical result. It intentionally does not join the live
// organization or membership, whose profile and state may have since changed.
GetOrganizationCreationResult(ctx context.Context, scopeHash []byte) ([]byte, error)
// Reads an organization together with the membership of one account in it
// and its representatives in list order, as one statement, so the profile and
// the list come from one snapshot. Only an active membership matches, so an
// unknown organization, an account that is no member, and a suspended,
// removed, or left member all return no row and cannot be told apart.
GetOrganizationForMember(ctx context.Context, arg GetOrganizationForMemberParams) (GetOrganizationForMemberRow, error)
// Read only the immutable original response. The current need may have moved
// to a later version since this result was created.
GetOrganizationNeedCreationResult(ctx context.Context, scopeHash []byte) (string, error)
// Reads the relay backlog for metrics without locking. Both subqueries use
// the partial index on unpublished positions, so the cost follows the backlog
// size, not the table size. The age comes from the database clock, the same
// clock that set occurred_at.
GetOutboxBacklog(ctx context.Context) (GetOutboxBacklogRow, error)
GetPolicyVersionByID(ctx context.Context, id pgtype.UUID) (PolicyVersion, error)
// The published version of a family, if any. The partial unique index
// assessment_families_one_published_key allows at most one.
GetPublishedAssessmentFamily(ctx context.Context, familyKey string) (AssessmentFamily, error)
// Reads the backlog for metrics without locking: jobs that a worker may
// claim at now, how long the earliest of them has waited, and the dead
// jobs. The
// partial indexes keep the cost proportional to those rows. now is the
// application clock.
GetScheduledJobBacklog(ctx context.Context, now pgtype.Timestamptz) (GetScheduledJobBacklogRow, error)
// Reads the status of a job whose completion found it changed, inside
// the handler transaction that holds its row lock: only that transaction
// can have changed it, for example by canceling its own job.
GetScheduledJobStatus(ctx context.Context, id int64) (string, error)
// Reads the token a delivery is bound to and the account it is addressed to
// in one statement, for the check right before a service mail is sent. It
// takes no lock. It reads the account address only as the comparison key and
// selects no token hash. A missing binding or token row gives NULL token
// columns.
GetServiceMailState(ctx context.Context, id pgtype.UUID) (GetServiceMailStateRow, error)
GetSyntheticCategoryReview(ctx context.Context, arg GetSyntheticCategoryReviewParams) (AssessmentSyntheticCategoryReview, error)
GetUnrevokedConsentRecordByVersion(ctx context.Context, arg GetUnrevokedConsentRecordByVersionParams) (GetUnrevokedConsentRecordByVersionRow, error)
GetUserByEmailNormalized(ctx context.Context, emailNormalized string) (User, error)
GetUserByID(ctx context.Context, id pgtype.UUID) (User, error)
InsertAssessmentAnswerObservation(ctx context.Context, arg InsertAssessmentAnswerObservationParams) error
// Inserts the attempt header. The database guard rechecks the current policy,
// opening or disjoint training binding, and immutable pins.
InsertAssessmentAttempt(ctx context.Context, arg InsertAssessmentAttemptParams) error
InsertAssessmentAttemptIdempotencyOutcome(ctx context.Context, arg InsertAssessmentAttemptIdempotencyOutcomeParams) error
// Stores the immutable generated variant and empty answer slot.
InsertAssessmentAttemptItem(ctx context.Context, arg InsertAssessmentAttemptItemParams) error
// Stores one immutable candidate-visible result with the decision rationale
// and source versions used by its finalized attempt.
InsertAssessmentAttemptResult(ctx context.Context, arg InsertAssessmentAttemptResultParams) error
// Stores the category decision and current grade captured at real-attempt
// finalization. The base result document remains its original v1 shape.
InsertAssessmentAttemptResultV2(ctx context.Context, arg InsertAssessmentAttemptResultV2Params) error
// Stores an explicit mapping against a newly-created immutable opening. The
// insert trigger checks the opening, declared reviewer, current policy, and
// live coverage; the adapter supplies the fingerprint of the published set.
InsertAssessmentCategoryCatalogBinding(ctx context.Context, arg InsertAssessmentCategoryCatalogBindingParams) error
// Stores an opening. The insert trigger derives required_families from the
// policy document and counts the published families, and the coverage CHECK
// refuses the row when they are fewer; both numbers from the caller are
// replaced by the trigger's.
InsertAssessmentCategoryOpening(ctx context.Context, arg InsertAssessmentCategoryOpeningParams) (AssessmentCategoryOpening, error)
// Stores a new family version as a draft and returns the stored row with the
// creation time set by the stamp trigger. A taken ID or (family_key, version)
// returns no row instead of an error, so a conflict does not abort the
// surrounding transaction.
InsertAssessmentFamily(ctx context.Context, arg InsertAssessmentFamilyParams) (AssessmentFamily, error)
InsertAssessmentOriginMark(ctx context.Context, arg InsertAssessmentOriginMarkParams) error
InsertAssessmentReviewRead(ctx context.Context, arg InsertAssessmentReviewReadParams) error
// The attempt row is already locked by the caller. Store a parent before its
// bounded child events, in the same transaction as the immutable receipt.
InsertAssessmentSignalBatch(ctx context.Context, arg InsertAssessmentSignalBatchParams) error
// Each inserted event is checked by the database guard against attempt state
// and the aggregate capacity as a second line of defense.
InsertAssessmentSignalEvent(ctx context.Context, arg InsertAssessmentSignalEventParams) error
// The first acknowledgement wins; a repeat keeps the stored time and inserts
// nothing. The caller reads the stored row afterwards in the same transaction.
InsertAssessmentSignalNoticeAcknowledgement(ctx context.Context, arg InsertAssessmentSignalNoticeAcknowledgementParams) error
// Save exactly one immutable response receipt for each live idempotency scope.
InsertAssessmentSignalOutcome(ctx context.Context, arg InsertAssessmentSignalOutcomeParams) error
// Records a successfully authorized view after visibility and quota checks.
// The audit contains only identities, the access kind, published field codes,
// and time; it never receives the projection content, ranking, or filters.
InsertCandidateCardAccessEvent(ctx context.Context, arg InsertCandidateCardAccessEventParams) error
// Hides one organization. No row returns when the pair already exists, and
// the caller reads the existing record with its original time. The foreign key
// refuses an unknown organization (SQLSTATE 23503); the caller answers it
// exactly like an organization the candidate cannot see. The trigger refuses
// the 1001st record (candidate_hidden_organizations_limit). The trigger runs
// before the conflict check, so the caller reads the existing record first
// and a repeat at the limit is never refused.
InsertCandidateHiddenOrganization(ctx context.Context, arg InsertCandidateHiddenOrganizationParams) (CandidateHiddenOrganization, error)
// Appends one event to the settings history. The row holds identifiers, card
// field codes, and times, never a name; the caller
// writes it in the transaction of the change it records.
InsertCandidatePrivacyEvent(ctx context.Context, arg InsertCandidatePrivacyEventParams) error
// Queries of the manual candidate profile. The profile is personal
// data of the account that owns it: every statement is scoped by user_id, and
// no statement selects another account's row. None of them names a file, the
// ML service, or an FSP account, because the profile needs none.
// Stores the first save of a profile at version 1. No row returns when the
// account already has a profile, so a first save that lost a race with
// another first save from another tab can be told apart and answered as a
// version conflict.
InsertCandidateProfile(ctx context.Context, arg InsertCandidateProfileParams) (CandidateProfile, error)
// Stores one claim of the new set. Provenance fields are the domain's; the
// statement never takes a trust level from the caller, because every claim
// has level 0.
InsertCandidateProfileClaim(ctx context.Context, arg InsertCandidateProfileClaimParams) error
InsertCandidateProfileOverlapConfirmation(ctx context.Context, arg InsertCandidateProfileOverlapConfirmationParams) error
// Stores the first publication at version 1. No row returns when the account
// already has a row, so a first publication that lost a race with another
// one is answered as a version conflict. The foreign key refuses a record
// that is not a C2 record of this account.
InsertCandidatePublication(ctx context.Context, arg InsertCandidatePublicationParams) (InsertCandidatePublicationRow, error)
// Creates the first saved questionnaire. A missing row is version zero;
// concurrent first saves race on the primary key and exactly one returns a row.
InsertCandidateQuestionnaire(ctx context.Context, arg InsertCandidateQuestionnaireParams) (CandidateQuestionnaire, error)
InsertCandidateQuestionnaireSpecialization(ctx context.Context, arg InsertCandidateQuestionnaireSpecializationParams) error
// Stores the first status at version 1; no row returns when one exists.
InsertCandidateSearchStatus(ctx context.Context, arg InsertCandidateSearchStatusParams) (InsertCandidateSearchStatusRow, error)
InsertCompanyInvitationQuotaUsage(ctx context.Context, arg InsertCompanyInvitationQuotaUsageParams) error
// Records a grant of C1, C2, C3, or C5. An unrevoked record of the same
// subject, purpose, and text version already exists when no row returns;
// the insert then changes nothing and does not abort the transaction.
InsertConsentRecord(ctx context.Context, arg InsertConsentRecordParams) (InsertConsentRecordRow, error)
// Stores a record that a consumer could not apply. A second delivery of the
// same record (same position and value) refreshes the outcome of its row:
// after a rewind the handler may fail differently. A different value at a
// reused position, after the topic was recreated, gets its own row.
InsertConsumerDeadLetter(ctx context.Context, arg InsertConsumerDeadLetterParams) error
// Records a C4 grant with its scope. The invitation already has a C4 record
// when no row returns; the insert then changes nothing and does not abort
// the transaction.
InsertContactConsentRecord(ctx context.Context, arg InsertContactConsentRecordParams) (InsertContactConsentRecordRow, error)
// Stores a new delivery. A delivery with the same ID already exists when the
// same request is handled again; the statement then inserts nothing and
// returns 0 rows, and the stored content stays as it was. While another
// transaction holds an uncommitted row with the same ID, the insert waits
// for it.
InsertDelivery(ctx context.Context, arg InsertDeliveryParams) (int64, error)
InsertEmailToken(ctx context.Context, arg InsertEmailTokenParams) error
// The invitation row, its first terms version, and its first audit event are
// inserted in one caller-owned transaction. The deferred reference to the
// current terms version is checked when the transaction commits.
InsertInvitation(ctx context.Context, arg InsertInvitationParams) error
InsertInvitationDecline(ctx context.Context, arg InsertInvitationDeclineParams) error
InsertInvitationDeclineResult(ctx context.Context, arg InsertInvitationDeclineResultParams) error
InsertInvitationEvent(ctx context.Context, arg InsertInvitationEventParams) error
InsertInvitationSendResult(ctx context.Context, arg InsertInvitationSendResultParams) error
InsertInvitationTermsVersion(ctx context.Context, arg InsertInvitationTermsVersionParams) error
InsertMailQuotaReservation(ctx context.Context, arg InsertMailQuotaReservationParams) error
InsertMailRequest(ctx context.Context, arg InsertMailRequestParams) error
InsertMembership(ctx context.Context, arg InsertMembershipParams) error
// Store one recipient's reference to a delivered invitation event. The
// unique key absorbs at-least-once redelivery without copying event content.
InsertNotificationInboxEvent(ctx context.Context, arg InsertNotificationInboxEventParams) (int64, error)
// Stores a new organization with the verification level that the domain
// gave it. The deferred constraint organizations_owner_required fails the
// transaction at commit unless an active owner membership was inserted in
// it too.
InsertOrganization(ctx context.Context, arg InsertOrganizationParams) error
// The parent and first immutable snapshot are inserted in one caller-owned
// transaction. Deferred version references are checked when it commits.
InsertOrganizationNeed(ctx context.Context, arg InsertOrganizationNeedParams) error
InsertOrganizationNeedVersion(ctx context.Context, arg InsertOrganizationNeedVersionParams) error
// Stores one representative at its position in the list. The adapter calls it
// once per representative after it deleted the previous list, in the same
// transaction.
InsertOrganizationRepresentative(ctx context.Context, arg InsertOrganizationRepresentativeParams) error
InsertOutboxEvent(ctx context.Context, arg InsertOutboxEventParams) error
// Stores a version and returns the stored row with the publication time and
// effective time set by the stamp trigger. A taken ID or version number
// returns no row instead of an error, so a conflict does not abort the
// surrounding transaction. created_at is never taken from the caller, and a
// NULL effective_at means "at publication".
InsertPolicyVersion(ctx context.Context, arg InsertPolicyVersionParams) (PolicyVersion, error)
// Records that a consumer applies an event, in the transaction of the effect.
// It returns 0 rows when the marker exists. While another transaction holds
// an uncommitted marker for the same key, the insert waits for it: after a
// commit it returns 0, after a rollback it inserts. So a concurrent duplicate
// never runs the effect at the same time as the first delivery.
InsertProcessedEventMarker(ctx context.Context, arg InsertProcessedEventMarkerParams) (int64, error)
// Lock order. A job handler runs while its transaction holds the row lock
// of the job, and may then lock product rows. A business transaction that
// cancels a job should cancel it before it locks the product rows the
// handler touches, so both take the locks in the same order.
// Schedules a job in the caller's transaction. The first schedule of a
// (kind, dedup_key) wins: a repeat, also after the job finished or was
// canceled, inserts nothing and reports 0 rows, so a repeated command never
// moves a deadline. A concurrent insert of the same key waits for the first
// transaction and then inserts nothing, or inserts after its rollback.
InsertScheduledJob(ctx context.Context, arg InsertScheduledJobParams) (int64, error)
InsertSession(ctx context.Context, arg InsertSessionParams) error
// The initial public history is inserted in the caller's case transaction.
// Any unique business conflict leaves the transaction usable so the caller can
// store the immutable 409 outcome under the request's idempotency key.
InsertSupportCase(ctx context.Context, arg InsertSupportCaseParams) (int64, error)
InsertSupportCaseCreateOutcome(ctx context.Context, arg InsertSupportCaseCreateOutcomeParams) error
InsertSupportCaseEvent(ctx context.Context, arg InsertSupportCaseEventParams) error
InsertSupportCaseRequestEvent(ctx context.Context, arg InsertSupportCaseRequestEventParams) error
// The application accepts only a validated immutable review snapshot. The
// trigger independently checks the source opening, manifest and policy. A
// concurrent or repeated attestation of the same exact source inserts nothing,
// and the caller reads the stored one.
InsertSyntheticCategoryReview(ctx context.Context, arg InsertSyntheticCategoryReviewParams) (int64, error)
InsertUser(ctx context.Context, arg InsertUserParams) error
InvalidateActiveEmailTokens(ctx context.Context, arg InvalidateActiveEmailTokensParams) (int64, error)
// A requirements version that a need of the organization has had is the
// version number of a stored snapshot whose own requirements version is that
// number, so a later edit that only renamed the need is not accepted.
InvitationNeedVersionExists(ctx context.Context, arg InvitationNeedVersionExistsParams) (bool, error)
// Read the latest serialized event so a temporarily regressing application
// clock cannot make the next request fall before an event already counted.
LatestSupportCaseRequestEvent(ctx context.Context, ownerID pgtype.UUID) (pgtype.Timestamptz, error)
// An attempt holds at most 220 items, so the list is bounded by the attempt.
ListAssessmentAnswerTimes(ctx context.Context, attemptID pgtype.UUID) ([]ListAssessmentAnswerTimesRow, error)
// Reads chain headers in creation order. The use case verifies root eligibility
// and descending target grades in the domain before it creates a correction.
ListAssessmentAttemptChain(ctx context.Context, arg ListAssessmentAttemptChainParams) ([]AssessmentAttempt, error)
// Reads private frozen variants and candidate answer bytes in stable order.
ListAssessmentAttemptItems(ctx context.Context, attemptID pgtype.UUID) ([]ListAssessmentAttemptItemsRow, error)
// Reads roots within the policy horizon and the last header in each correction
// chain. It deliberately omits frozen items, answers, and row locks.
ListAssessmentAvailabilityRootSummaries(ctx context.Context, arg ListAssessmentAvailabilityRootSummariesParams) ([]ListAssessmentAvailabilityRootSummariesRow, error)
// Counts family instances disclosed after the non-repeat boundary. The first
// item is disclosed when the attempt is created; each later item is disclosed
// when the preceding answer is accepted. This per-item timestamp prevents a
// long-running attempt from making later items appear older than they are.
// Counting the first unanswered item after expiry is conservative when the
// final response was lost, while frozen future items remain excluded.
ListAssessmentDisclosedFamilyKeys(ctx context.Context, arg ListAssessmentDisclosedFamilyKeysParams) ([]string, error)
// Compares this attempt with every other attempt separately. A matched answer
// is an equal fingerprint of the same family version under the same key
// generation, given by another candidate to a different seed variant. It
// carries -log2 of the share of answers that hold that fingerprint, read from
// the maintained counters, between
// zero and the cap of its format, and the bits of one pair add up. Pairs under
// min_bits are dropped, the strongest come first, and the list is bounded.
// An attempt has ended when its state is terminal or its deadline has passed.
ListAssessmentDuplicatePairs(ctx context.Context, arg ListAssessmentDuplicatePairsParams) ([]ListAssessmentDuplicatePairsRow, error)
// One page of the versions of a category in key and version order, after the
// given position; an empty key and version 0 start at the beginning. The
// (family_key, version) unique index serves the scan.
ListAssessmentFamiliesByCategory(ctx context.Context, arg ListAssessmentFamiliesByCategoryParams) ([]AssessmentFamily, error)
// Marks exist only where the session or the network changed. The bound keeps a
// request that flaps between networks from growing the list without limit.
ListAssessmentOriginMarks(ctx context.Context, attemptID pgtype.UUID) ([]AssessmentAttemptOriginMark, error)
// Reads the exact family membership pinned by a training binding.
ListAssessmentTrainingBindingFamilies(ctx context.Context, bindingID pgtype.UUID) ([]ListAssessmentTrainingBindingFamiliesRow, error)
// The caller validates and signs an opaque owner-bound cursor. This query
// applies the keyset to the same stable order and fetches one extra row.
ListCandidateAssessmentResults(ctx context.Context, arg ListCandidateAssessmentResultsParams) ([]ListCandidateAssessmentResultsRow, error)
// Lists only the current candidate's own access history. It deliberately
// omits the employee, requested card fields, and search context. The privacy
// read adapter resolves an organization name only through this recorded
// access relation, which is already visible to the candidate.
ListCandidateCardAccessEvents(ctx context.Context, arg ListCandidateCardAccessEventsParams) ([]ListCandidateCardAccessEventsRow, error)
// Skill evidence reads. The projection tables hold no answer, score, item,
// failure, or anti-cheat data, and none of these statements names the result,
// attempt, or review tables: evidence is read from its own facts only.
// The candidate's own facts, hidden ones included, newest event first. Every
// statement is scoped by the owner; the caller passes the continuation
// position of the previous page, if any, and fetches one extra row.
ListCandidateEvidenceFacts(ctx context.Context, arg ListCandidateEvidenceFactsParams) ([]ListCandidateEvidenceFactsRow, error)
// One page of the candidate's hidden organizations, newest first with the
// organization identifier as the tie-breaker. The page continues after the
// (hidden_at, organization_id) position of the last record of the previous
// page.
ListCandidateHiddenOrganizations(ctx context.Context, arg ListCandidateHiddenOrganizationsParams) ([]ListCandidateHiddenOrganizationsRow, error)
// One bounded page of the candidate's inbox: every invitation delivered to
// the candidate, in any later state, newest first by delivery time. Drafts
// have no delivery and are never listed. The candidate scopes the rows, so
// no identifier of another candidate can appear.
ListCandidateInvitations(ctx context.Context, arg ListCandidateInvitationsParams) ([]ListCandidateInvitationsRow, error)
// The same selection for the candidate's own card preview, so the candidate
// sees what an organization would read. It is scoped by the owner and runs
// after the caller locked the effective C2 and publication; it does not apply
// an organization or a cohort.
ListCandidatePreviewEvidence(ctx context.Context, arg ListCandidatePreviewEvidenceParams) ([]ListCandidatePreviewEvidenceRow, error)
// One page of the candidate's settings history, newest first with the event
// identifier as the tie-breaker. The organization name is resolved here, at
// read time, and is the current name. The page continues after the
// (occurred_at, id) position of the last event of the previous page.
ListCandidatePrivacyEvents(ctx context.Context, arg ListCandidatePrivacyEventsParams) ([]ListCandidatePrivacyEventsRow, error)
// One page of the subject's ledger, newest grant first, optionally limited
// to one state. Every record query is scoped by the subject, so a caller
// never reads or revokes another subject's consent. The state is computed,
// never stored: revoked once revoked_at is set; superseded when a newer
// unrevoked record of the same subject and purpose exists (never for C4,
// whose records are scoped by invitation); active otherwise. The page continues after the (granted_at, id) position of
// the last record of the previous page.
ListConsentRecords(ctx context.Context, arg ListConsentRecordsParams) ([]ListConsentRecordsRow, error)
// Returns current reviewed grade/language bindings and the live published
// family manifest at one caller-supplied database time. The adapter verifies
// the pinned manifest hash before exposing only family keys.
ListCurrentAssessmentAvailabilitySelections(ctx context.Context, asOf pgtype.Timestamptz) ([]ListCurrentAssessmentAvailabilitySelectionsRow, error)
// Lists explicit immutable training bindings for the effective product
// policy. Callers reject more than one matching active binding as ambiguous.
ListCurrentAssessmentTrainingBindings(ctx context.Context) ([]ListCurrentAssessmentTrainingBindingsRow, error)
ListCurrentContactConsentRecords(ctx context.Context, arg ListCurrentContactConsentRecordsParams) ([]ListCurrentContactConsentRecordsRow, error)
// Produces current catalog availability in one PostgreSQL statement snapshot.
// The adapter compares the ordered live family manifest with the pinned
// fingerprint; stale bindings are omitted fail-closed.
ListCurrentSpecializationAvailability(ctx context.Context) ([]ListCurrentSpecializationAvailabilityRow, error)
ListDeliveryAttempts(ctx context.Context, deliveryID pgtype.UUID) ([]DeliveryAttempt, error)
// One bounded newest-first page. Both the organization scope and the tuple
// cursor are applied before the limit.
ListInvitations(ctx context.Context, arg ListInvitationsParams) ([]ListInvitationsRow, error)
// List only the authenticated recipient's rows, optionally narrowed to one
// organization context. The caller resolves current source visibility before
// returning content.
ListNotificationInboxEvents(ctx context.Context, arg ListNotificationInboxEventsParams) ([]NotificationInboxEvent, error)
// Read one bounded newest-first page of current needs. Both the organization
// scope and the tuple cursor are applied before the limit.
ListOrganizationNeeds(ctx context.Context, arg ListOrganizationNeedsParams) ([]ListOrganizationNeedsRow, error)
// The evidence that one organization may read about one candidate: one fact
// for each category of the card, the fact that supports the confirmed grade
// of that category (the earliest one that passed exactly that grade, so a
// lower grade or a retake adds nothing). The statement selects from the
// effective publication view (published and backed by an unrevoked C2) and
// excludes the candidates that hide the reading organization, so no row means
// nothing to read, whatever the reason. The card must publish the categories
// field and only visible measurements qualify. The categories come from the
// caller as "specialization/grade" pairs taken from the card that was just
// projected, so the answer never names a skill the card does not show. The columns are
// an allowlist: no identifier of the fact, the event, the result, or the
// candidate leaves, the instant is cut to the year, and the basis and the
// calibration (the same for every candidate) say that the fact is a synthetic
// demonstration.
ListOrganizationVisibleEvidence(ctx context.Context, arg ListOrganizationVisibleEvidenceParams) ([]ListOrganizationVisibleEvidenceRow, error)
// The same organization read for a whole candidate set, so a search reads the
// evidence of every listed candidate in one statement. The pairs come from the
// caller as two parallel arrays, one row per candidate and category of the card
// that was just projected. The statement repeats every barrier of the single
// read: the effective publication view, NOT EXISTS over the candidates that
// hide the organization, the categories field, and only visible measurements.
// The candidate identifier is returned for the caller to group by and never
// leaves the server; the other columns are the same allowlist.
ListOrganizationVisibleEvidenceBatch(ctx context.Context, arg ListOrganizationVisibleEvidenceBatchParams) ([]ListOrganizationVisibleEvidenceBatchRow, error)
// Lists the organizations where an account has an active membership,
// newest membership first. The page continues after the (membership
// creation time, organization ID) position of the last item of the
// previous page. Only the active memberships of the given account match.
ListOrganizationsForUser(ctx context.Context, arg ListOrganizationsForUserParams) ([]ListOrganizationsForUserRow, error)
// Lists the other accounts of a provider that have usage in a month, so
// startup can warn about a renamed EMAIL_ACCOUNT.
ListOtherMailQuotaAccounts(ctx context.Context, arg ListOtherMailQuotaAccountsParams) ([]string, error)
// Owner-scoped newest-first list. It omits descriptions, complaint reason,
// and event history. The tuple cursor matches the composite sort key.
ListOwnedSupportCases(ctx context.Context, arg ListOwnedSupportCasesParams) ([]ListOwnedSupportCasesRow, error)
// Organization-facing anonymous candidate projection inputs. The calling
// usecase has already authorized the active organization membership. This
// single statement snapshot filters both revoked/unpublished C2 states and
// candidates hidden from this organization before any profile value is read.
// The projection reads only stack, declared role, and experience dates. It
// deliberately excludes names, contacts, salary, location, soft skills,
// employer names, summaries, and imported excerpts. The only assessment data
// is the current category (specialization and grade) of the separate current
// category table; it carries no attempt, score, review, policy, or history.
ListVisibleCandidateViewSources(ctx context.Context, organizationID pgtype.UUID) ([]ListVisibleCandidateViewSourcesRow, error)
// Locks the organization first and then the active membership, using the
// same order as organization profile writes. A company operation keeps both
// share locks until its transaction commits, so a concurrent revocation
// cannot authorize a write after it has committed.
LockActiveMembership(ctx context.Context, arg LockActiveMembershipParams) (LockActiveMembershipRow, error)
// Locks one owner-scoped attempt while a session command performs its CAS.
LockAssessmentAttemptForCandidate(ctx context.Context, arg LockAssessmentAttemptForCandidateParams) (AssessmentAttempt, error)
// Serializes root quota checks for one candidate before taking its optional
// specialization or training lock. All callers acquire these locks in order.
LockAssessmentAttemptScope(ctx context.Context, arg LockAssessmentAttemptScopeParams) error
// Serializes the operations that change which versions of a category are
// published or open the category, until the transaction ends. The key is
// namespaced, so it cannot collide with another use of advisory locks.
LockAssessmentCategory(ctx context.Context, category string) error
// Serializes the evaluations of one review. A job takes these locks for every
// attempt it will write, in ascending attempt order, before it reads any fact,
// so what it reads is what the previous writer committed.
LockAssessmentReview(ctx context.Context, attemptID string) error
// Lock the account before an organization checks candidate visibility. The
// hidden-organization insert trigger takes FOR NO KEY UPDATE on this row, so
// a hide either commits before the later visibility recheck or waits for the
// read transaction to finish.
LockCandidateAccountForView(ctx context.Context, candidateID pgtype.UUID) (pgtype.UUID, error)
// Acquired after C3, candidate/specialization scope, and attempt row locks.
// This independent lock serializes current category upgrades for one scope.
LockCandidateAssessmentCategory(ctx context.Context, arg LockCandidateAssessmentCategoryParams) error
// Lock one delivered invitation addressed to the candidate. Only the
// invitation row is locked, never the organization.
LockCandidateInvitation(ctx context.Context, arg LockCandidateInvitationParams) (pgtype.UUID, error)
// Locks the candidate's published row only when it refers to a C2 record
// revoked by this transaction. The setting remains linked to that immutable
// record; ReadCandidatePublication computes the effective closed state and
// keeps the consent-revoked reason after later grants. The returned time is
// the effective close time used by the privacy history event.
LockCandidatePublicationForConsentRevocation(ctx context.Context, arg LockCandidatePublicationForConsentRevocationParams) (pgtype.Timestamptz, error)
// Locks the delivery row of the lease holder until the transaction ends, so
// every path that settles a send takes the delivery lock before the quota
// rows, the same order as the claim. No row means that owner no longer holds
// the lease.
LockClaimedDelivery(ctx context.Context, arg LockClaimedDeliveryParams) (pgtype.UUID, error)
// Locks a claimed job for its handler transaction and checks that the lease
// still belongs to this attempt. It returns no row when the job was
// canceled, or reclaimed after the lease expired. While the lock is held,
// other workers skip the row, so the handler never runs twice at once.
LockClaimedScheduledJob(ctx context.Context, arg LockClaimedScheduledJobParams) (int64, error)
LockCompanyQuotaOrganization(ctx context.Context, organizationID pgtype.UUID) (LockCompanyQuotaOrganizationRow, error)
// Writers lock the organization first, then invitation/card-view state, and
// finally usage rows. The organization lock serializes quota decisions for
// the tenant and makes the subsequent count and insert atomic.
// Takes the organization lock ahead of every share lock of a reader that will
// reserve usage later. FOR NO KEY UPDATE conflicts with itself and with FOR
// SHARE, so readers of one organization queue up instead of deadlocking on a
// share lock that each then tries to raise, but it does not conflict with the
// FOR KEY SHARE that a foreign key takes, such as the hidden-organization
// insert of a candidate, which holds the candidate's row and then needs this
// one. The reservation itself still takes FOR UPDATE inside the same
// transaction.
LockCompanyQuotaOrganizationFirst(ctx context.Context, organizationID pgtype.UUID) (pgtype.UUID, error)
// Lock the current C2 before locking the publication. C2 revocation updates
// this row before it locks the publication, so preserving this order avoids
// a lock inversion and makes the current consent stable through the read.
LockCurrentC2ForView(ctx context.Context, candidateID pgtype.UUID) (pgtype.UUID, error)
// Takes the candidate's current unrevoked C2 record for a publication and
// keeps it locked until the transaction ends. The share lock conflicts with
// the revocation stamp (an UPDATE of the row), so a revocation either commits
// before this statement, which then returns no row and the publication is
// refused, or waits until the publication transaction commits and closes the
// card right after. The caller must run it in the transaction that writes the
// publication and must re-read the effective state (ReadCandidatePublication)
// in that transaction to build its response.
LockCurrentC2Record(ctx context.Context, subjectID pgtype.UUID) (pgtype.UUID, error)
// Keeps the current C3 grant stable through a real assessment transaction.
// Revocation updates this row and therefore waits until the caller commits.
LockCurrentConsentForUse(ctx context.Context, subjectID pgtype.UUID) (LockCurrentConsentForUseRow, error)
// Takes the row lock of one invitation. It is a statement of its own, ahead of
// ReadInvitation, because a locking read that joins the terms table is
// re-checked against the new row version after a wait and then pairs the
// updated terms_version with the terms row it fetched before the wait, which
// finds nothing. Once the lock is held, the following read sees the committed
// state and no writer can change it.
LockInvitation(ctx context.Context, arg LockInvitationParams) (pgtype.UUID, error)
// Locks the listed window rows until the transaction ends, in
// (period_kind, period_start) order, the same order for every caller, and
// returns their usage. Under READ COMMITTED a waiting caller reads the usage
// the first caller committed. period_starts narrows the index scan;
// window_keys selects the exact rows.
LockMailQuotaRows(ctx context.Context, arg LockMailQuotaRowsParams) ([]LockMailQuotaRowsRow, error)
// Locks a request for the consumer transaction that turns it into a
// delivery. A concurrent consumer of the same request waits here and then
// finds the row deleted. The account cleanup and the cascade from users take
// the same row lock, so a request is never converted for an account whose
// deletion is in progress without one of the two transactions waiting.
LockMailRequest(ctx context.Context, id pgtype.UUID) (MailRequest, error)
// Locks the next relay batch. For each aggregate only its earliest unpublished
// event (lowest aggregate_version, then position) qualifies, so a relay never
// holds a later version while an earlier one is still pending, whether that
// earlier row is locked by another relay or was just rolled back. Rows locked
// by another relay are skipped without waiting. The statement snapshot can
// only see a later version after the earlier version's transaction committed,
// because aggregate writers check the expected version, so scanning without a
// position watermark cannot overtake an earlier version.
LockPendingOutboxEvents(ctx context.Context, batchLimit int32) ([]LockPendingOutboxEventsRow, error)
// Lock a candidate's current publication for the private preview. This has
// no organization context and never enters the employer read quota or audit.
LockPublicationForCandidatePreview(ctx context.Context, candidateID pgtype.UUID) (pgtype.UUID, error)
// Locks the active registration C1 while its pending registration is applied.
LockRegistrationConsentRecord(ctx context.Context, arg LockRegistrationConsentRecordParams) (LockRegistrationConsentRecordRow, error)
// Serialize per-owner budget checks even before the first event exists.
LockSupportCaseRequestBudget(ctx context.Context, ownerID pgtype.UUID) error
// Lock and recheck one candidate's exact current publication only after the
// active C2 row is share-locked. No row includes unpublished, revoked, stale
// publication, and organization-hidden states.
LockVisiblePublicationForView(ctx context.Context, arg LockVisiblePublicationForViewParams) (pgtype.UUID, error)
// Notes that a request is about to start, by the database clock, and clears
// the count of worker failures. For an operator-authorized send, this sets
// its single-use marker without overwriting the original first-send time. The
// marker captures the current attempt_count so a lost result can be recovered
// as unknown instead of silently retried. When require_dedup_window is true,
// the age check is repeated here after quota work and the row lock, immediately
// before the network call; manual starts never reset that original window.
MarkDeliverySendStarted(ctx context.Context, arg MarkDeliverySendStartedParams) (int64, error)
// Records that the provider refused a send because the quota of a window is
// used up: the usage rises to at least the configured limit, so the local
// gate stops admitting sends until the window resets or an operator raises
// the limit. The caller holds the row lock.
MarkMailQuotaExhausted(ctx context.Context, arg MarkMailQuotaExhaustedParams) (int64, error)
// Persist the first read time for the recipient, optionally under one exact
// organization context. A missing organization is the candidate cabinet,
// which spans the organizations that sent to it; the employer cabinet always
// names its organization. Repeated calls preserve the original read
// timestamp.
MarkNotificationInboxEventRead(ctx context.Context, arg MarkNotificationInboxEventReadParams) (NotificationInboxEvent, error)
// Marks the events that the broker acknowledged. The relay passes only IDs
// whose rows its own transaction locked, so the statement never waits and the
// count equals the number of distinct IDs.
MarkOutboxEventsPublished(ctx context.Context, eventIds []pgtype.UUID) (int64, error)
// Verifies the email only for the registration version the consumed token
// was issued for.
MarkUserEmailVerified(ctx context.Context, arg MarkUserEmailVerifiedParams) (User, error)
// Case numbers are monotonic and never reused. Sequence gaps on a rolled-back
// request are expected and do not expose request contents.
NextSupportCaseNumber(ctx context.Context, utcYear string) (interface{}, error)
Ping(ctx context.Context) (int32, error)
// Reports whether a family has any version without reading a document, so a
// caller that only needs presence never depends on decoding.
PolicyVersionExists(ctx context.Context, policyKey string) (bool, error)
// Keep up to the maximum supported window, regardless of the current policy.
// The bounded delete prevents one create from doing unbounded cleanup work.
PruneSupportCaseRequestEvents(ctx context.Context, arg PruneSupportCaseRequestEventsParams) (int64, error)
// Moves a draft to published by the named operator and returns the row with
// the publication time set by the guard trigger. No row means the version
// was not a draft any more.
PublishAssessmentFamily(ctx context.Context, arg PublishAssessmentFamilyParams) (AssessmentFamily, error)
// Deletes at most batch_limit expired records. Locked rows are skipped, so
// the statement never waits for a concurrent reservation.
PurgeExpiredIdempotencyRecords(ctx context.Context, arg PurgeExpiredIdempotencyRecordsParams) (int64, error)
// Read one delivered invitation addressed to the candidate. A draft and an
// invitation of another candidate find nothing.
ReadCandidateInvitation(ctx context.Context, arg ReadCandidateInvitationParams) (ReadCandidateInvitationRow, error)
// Read one delivered invitation addressed to the candidate with the current
// name of the organization that sent it. A draft and an invitation of
// another candidate find nothing.
ReadCandidateInvitationEntry(ctx context.Context, arg ReadCandidateInvitationEntryParams) (ReadCandidateInvitationEntryRow, error)
// Queries of the candidate visibility settings: the publication of
// the card, the search status, the hidden organizations, and the history of
// these settings. Every statement is scoped by the candidate's user_id, and
// no statement selects another account's row. No statement reads or writes a
// profile value, a name, or a contact. A candidate with no row is closed, not
// looking, and hides nobody; no statement creates a row except an explicit
// act of the candidate.
// Reads the candidate-owned settings and hidden count from one statement
// snapshot. Missing setting rows are restored as the closed/not-looking
// defaults in the adapter. The account row scopes the result but does not
// expose private profile values.
ReadCandidatePrivacySettings(ctx context.Context, userID pgtype.UUID) (ReadCandidatePrivacySettingsRow, error)
// Reads the profile row of an account together with every claim in one
// statement, so the version and the claims come from one snapshot: a save that
// commits between two separate reads could pair version N with the claims of
// N+1. A profile without a claim returns one row with NULL claim columns, and
// no row at all means the account has not saved a profile (contract version
// 0). Claims come in a stable order: single fields by kind, list items by
// position. Never replace this with two statements.
ReadCandidateProfile(ctx context.Context, userID pgtype.UUID) ([]ReadCandidateProfileRow, error)
// Reads the publication with the revocation state of the C2 record behind it
// in one statement, so the stored setting and the ledger come from one
// snapshot. The effective state is computed from them: published only while
// consent_revoked_at is NULL. No row means the candidate never published.
ReadCandidatePublication(ctx context.Context, userID pgtype.UUID) (ReadCandidatePublicationRow, error)
// Reads the aggregate and its ordered specializations in one statement so a
// response never pairs a version with another version's answers.
ReadCandidateQuestionnaire(ctx context.Context, userID pgtype.UUID) (ReadCandidateQuestionnaireRow, error)
// No row means the status was never set, which reads as not looking. The
// lapse is computed by the caller from lapses_at and its clock and is never
// written.
ReadCandidateSearchStatus(ctx context.Context, userID pgtype.UUID) (CandidateSearchStatus, error)
// Read the candidate's current private projection inputs after the caller
// locks its active C2 and publication. It selects only fields allowed in the
// anonymous-card projection and is never used for employer visibility.
ReadCandidateViewSourceForPreview(ctx context.Context, candidateID pgtype.UUID) ([]ReadCandidateViewSourceForPreviewRow, error)
// Read one current version with its organization-scoped parent metadata.
ReadCurrentOrganizationNeed(ctx context.Context, arg ReadCurrentOrganizationNeedParams) (ReadCurrentOrganizationNeedRow, error)
// Read one current invitation with its terms snapshot. Both the organization
// and the invitation scope the row, so another organization's identifier
// finds nothing.
ReadInvitation(ctx context.Context, arg ReadInvitationParams) (ReadInvitationRow, error)
ReadInvitationDecline(ctx context.Context, arg ReadInvitationDeclineParams) (InvitationDecline, error)
// Read one historical terms version of one invitation of one organization.
ReadInvitationTermsVersion(ctx context.Context, arg ReadInvitationTermsVersionParams) (string, error)
// Read one historical version without exposing another organization's record.
ReadOrganizationNeedVersion(ctx context.Context, arg ReadOrganizationNeedVersionParams) (string, error)
// Reads a full owner-scoped record. Object values are identifiers only.
ReadOwnedSupportCase(ctx context.Context, arg ReadOwnedSupportCaseParams) (SupportCase, error)
// The organization-facing read of a candidate's publication: the effective
// view (published and backed by an unrevoked C2) and no hiding of the reading
// organization. No row means the organization reads nothing, whichever of
// the reasons applies, so it cannot tell a hidden candidate from an
// unpublished one. Every organization-facing read of a publication starts
// from this shape.
ReadPublicationVisibleToOrganization(ctx context.Context, arg ReadPublicationVisibleToOrganizationParams) (ReadPublicationVisibleToOrganizationRow, error)
// Lists the exact published bank manifest while the category advisory lock is
// held by OpenCategory. Published families have passed the independent-review
// constraint before this read.
ReadPublishedAssessmentCategoryManifest(ctx context.Context, category string) ([]ReadPublishedAssessmentCategoryManifestRow, error)
ReadSupportCaseCreateOutcome(ctx context.Context, scopeHash []byte) (ReadSupportCaseCreateOutcomeRow, error)
// Reads the immutable public history only after the case owner has matched.
ReadSupportCaseEvents(ctx context.Context, caseID pgtype.UUID) ([]ReadSupportCaseEventsRow, error)
// Advances a delivery past one attempt and appends the attempt in one
// statement, so both happen or neither does, inside or outside a
// transaction. The update applies only while the stored version still
// equals expected_version; otherwise nothing is written and the statement
// returns 0 rows. Two workers that record the same attempt number therefore
// cannot both succeed. The lease of the sending worker ends with the
// attempt, and so does the count of worker failures. When lease_owner is
// given, the update applies only while that worker still holds the lease.
// A token mail that reaches a terminal status loses its bodies in the same
// statement, so the one-time token does not stay at rest; the trigger allows
// exactly this change of the content columns.
RecordDeliveryAttempt(ctx context.Context, arg RecordDeliveryAttemptParams) (int64, error)
// Records that the sending worker failed on a delivery, so a broken row does
// not stay at the head of the queue: the delivery is due again at
// next_attempt_at and its lease ends. With count_failure the failure is
// counted; after max_failures consecutive failures the delivery is cancelled
// with the reason processing_failed, which an operator sees, and a token mail
// loses its bodies. Without it nothing is counted and nothing is cancelled:
// the failure says nothing about the row (a transient storage error, or a
// stretch of failures across many rows). The row is touched only when no other
// worker holds a live lease on it: lease_owner may hold it, or the lease is
// free or expired. It returns the status after the change; no row means that
// the delivery is no longer pending or waiting, or another worker holds it.
// now is the application clock.
RecordDeliveryFailure(ctx context.Context, arg RecordDeliveryFailureParams) (string, error)
// The compare-and-swap of the first view: it applies only to a delivered
// invitation at the version the caller read and before its deadline, and it
// keeps the deadline.
RecordInvitationView(ctx context.Context, arg RecordInvitationViewParams) (pgtype.UUID, error)
// Records the latest settled outcome of a send under the reservation.
RecordMailQuotaOutcome(ctx context.Context, arg RecordMailQuotaOutcomeParams) (int64, error)
RefreshCompanyCardViewQuotaUsage(ctx context.Context, arg RefreshCompanyCardViewQuotaUsageParams) (int64, error)
// Gives a claimed delivery back without changing it, so the next pass may
// claim it. It matches only the lease of lease_owner: a delivery that another
// worker took over after the lease expired is left alone.
ReleaseDeliveryClaim(ctx context.Context, arg ReleaseDeliveryClaimParams) (int64, error)
// Marks a reservation released. It matches only an open reservation, so a
// repeated release changes nothing and returns 0 rows.
ReleaseMailQuotaReservation(ctx context.Context, arg ReleaseMailQuotaReservationParams) (int64, error)
// Gives back recipients of a released reservation. The caller holds the row
// locks. A window that the provider reported exhausted keeps its usage: the
// provider's answer outranks the local count until the window resets. The
// count never drops below zero.
ReleaseMailQuotaUsage(ctx context.Context, arg ReleaseMailQuotaUsageParams) (int64, error)
// Returns claimed jobs that did not finish, at shutdown or after a database
// failure outside the handler, so another worker can run them at once
// instead of after the lease expires. The attempt is not counted, because
// the job did not cause the failure. The same guard as the completion
// applies, one (id, attempt) pair per job. It returns the IDs it released.
ReleaseScheduledJobs(ctx context.Context, arg ReleaseScheduledJobsParams) ([]int64, error)
// Stores the replay record of a command. A record whose retention has passed
// is replaced, so the key is accepted as new after the retention. A live
// record is left as it is and nothing is returned; the caller then reads it
// with GetLiveIdempotencyRecord. Concurrent callers with the same scope wait
// on the row of the first one until its transaction ends.
ReserveIdempotencyRecord(ctx context.Context, arg ReserveIdempotencyRecordParams) (IdempotencyRecord, error)
// Finds candidate-requested selections across currently opened categories.
// The adapter validates policy and manifest freshness, locks the category,
// then runs this query again before it returns any pinned families.
ResolveCurrentAssessmentSelection(ctx context.Context, arg ResolveCurrentAssessmentSelectionParams) ([]ResolveCurrentAssessmentSelectionRow, error)
// Lists every current reviewed category binding for one exact public target.
// Manual support cases have no task-language selector, so the use case must
// accept a rubric only when one distinct current opening matches.
ResolveCurrentSupportCaseRubrics(ctx context.Context, arg ResolveCurrentSupportCaseRubricsParams) ([]ResolveCurrentSupportCaseRubricsRow, error)
RetireAssessmentFamily(ctx context.Context, arg RetireAssessmentFamilyParams) (AssessmentFamily, error)
// Revokes every unrevoked record of a purpose other than C4, superseded ones
// included, and returns them. A revocation time before the grant time, from
// clock skew between instances, is stamped at the grant time instead.
RevokeConsentRecords(ctx context.Context, arg RevokeConsentRecordsParams) ([]RevokeConsentRecordsRow, error)
// Revokes every unrevoked C4 record of the subject for one organization and
// returns them, with the same clamp of the revocation time as above.
RevokeContactConsentRecords(ctx context.Context, arg RevokeContactConsentRecordsParams) ([]RevokeContactConsentRecordsRow, error)
RevokeSession(ctx context.Context, arg RevokeSessionParams) (int64, error)
RevokeUserSessions(ctx context.Context, arg RevokeUserSessionsParams) (int64, error)
// Only strict grade upgrades replace the current row. The trigger enforces
// the same monotonic rule as a final guard against adapter mistakes. The
// grading policy is read from the immutable opening, and the guard trigger
// compares it with the policy captured in the assigned result.
SaveCandidateAssessmentCategory(ctx context.Context, arg SaveCandidateAssessmentCategoryParams) (int64, error)
SaveCompanyCardViewQuotaUsage(ctx context.Context, arg SaveCompanyCardViewQuotaUsageParams) error
SaveInvitationCreationResult(ctx context.Context, arg SaveInvitationCreationResultParams) error
// Stores the immutable domain snapshot of a successful create command. The
// generic idempotency row and this result are committed with the organization
// and owner membership. A reused expired scope replaces the snapshot in the
// same transaction as the new organization.
SaveOrganizationCreationResult(ctx context.Context, arg SaveOrganizationCreationResultParams) error
// The generic idempotency scope serializes retries. Replacing the child row
// is safe only in the transaction that reserves an expired scope for a new
// create; live retries read and return the stored response without writing.
SaveOrganizationNeedCreationResult(ctx context.Context, arg SaveOrganizationNeedCreationResultParams) error
// Bounds a consumer transaction on the server, local to the transaction.
// statement_timeout stops a slow statement; idle_in_transaction_session_timeout
// ends the session of a process that froze or lost the network inside the
// handler, which releases the processed-event marker that a concurrent
// duplicate waits for.
SetConsumerTransactionTimeouts(ctx context.Context, arg SetConsumerTransactionTimeoutsParams) error
// Bounds the claim transaction on the server. statement_timeout stops a
// statement that runs too long; idle_in_transaction_session_timeout ends the
// session, and with it the transaction and its row locks, when the client
// stays silent longer than a publish may take, for example after the process
// froze or lost the network without closing the connection. Both settings
// are local to the transaction.
SetRelayTransactionTimeouts(ctx context.Context, arg SetRelayTransactionTimeoutsParams) error
// Bounds a handler transaction on the server, local to the transaction.
// statement_timeout stops a slow statement; idle_in_transaction_session_timeout
// ends the session of a worker that froze or lost the network inside the
// handler, which releases the job row lock so the job can be reclaimed once
// its lease expires.
SetScheduledJobTransactionTimeouts(ctx context.Context, arg SetScheduledJobTransactionTimeoutsParams) error
// Starts a claimed attempt right before its handler transaction: it renews
// the lease from now and records the start, committed on its own. It
// changes nothing when the lease already expired by now or no longer
// belongs to this attempt, so a job whose turn in the batch came too late is
// never started on a lease that another worker may take over. now is the
// application clock.
StartScheduledJob(ctx context.Context, arg StartScheduledJobParams) (int64, error)
// Stops a due automatic retry of an unknown delivery without recording a
// fictitious provider attempt, for example when the 23-hour safety cutoff is
// reached after the claim but before the provider call.
StopUnknownDeliveryRetry(ctx context.Context, arg StopUnknownDeliveryRetryParams) (int64, error)
// Records activity on an active session and reports whether it is active.
// The row is written only when last_seen_at is older than touch_cutoff, so
// frequent requests do not rewrite it. last_seen_at never moves back, and a
// revoked, expired, or idle session is not revived; the update re-checks
// those conditions against a concurrent change.
TouchSession(ctx context.Context, arg TouchSessionParams) (TouchSessionRow, error)
// Stores one final answer before advancing the enclosing attempt version.
// The caller holds the owner-scoped attempt row lock for the surrounding unit.
UpdateAssessmentAttemptItemAnswer(ctx context.Context, arg UpdateAssessmentAttemptItemAnswerParams) (pgtype.UUID, error)
// Applies a versioned session transition after the attempt row is locked.
UpdateAssessmentAttemptSession(ctx context.Context, arg UpdateAssessmentAttemptSessionParams) (AssessmentAttempt, error)
// Applies an answer, expiry, or finalization transition after the attempt row
// is locked. Session limits and all immutable pins remain unchanged.
UpdateAssessmentAttemptTransition(ctx context.Context, arg UpdateAssessmentAttemptTransitionParams) (AssessmentAttempt, error)
// Replaces the publication over the version the caller read and advances the
// version in the same statement. No row returns for a stale version, which
// the caller answers as a version conflict. The update time never moves back,
// as in the profile.
UpdateCandidatePublication(ctx context.Context, arg UpdateCandidatePublicationParams) (UpdateCandidatePublicationRow, error)
// Replaces the status over the version the caller read. Looking also stores
// the new confirmation, lapse time, and policy version; not looking clears
// them. It never names the publication or the hidden organizations.
UpdateCandidateSearchStatus(ctx context.Context, arg UpdateCandidateSearchStatusParams) (UpdateCandidateSearchStatusRow, error)
// Stores a change of the delivery state that is not an attempt: a quota wait,
// a cancellation, or a new provider account before the first attempt. It
// applies only while the stored version still equals expected_version and
// returns 0 rows otherwise. The trigger refuses a provider change after an
// attempt. release_claim ends the lease of the sending worker with the
// change; a new provider account keeps it, because the worker rebinds a
// delivery it holds and then sends it.
UpdateDeliveryState(ctx context.Context, arg UpdateDeliveryStateParams) (int64, error)
// Changes the profile of an organization over the version the caller read
// and advances the version in the same statement. It names no verification
// column, so a profile update cannot move the trust level. The change
// applies only for an account whose active membership has one of the
// manager roles, checked in the statement itself so that a membership that
// ended after the caller's read still stops the write. The statement locks
// the organization row first and then the actor's membership row FOR SHARE,
// so a revocation that commits while the statement waits is seen again
// (EvalPlanQual) and stops the write; the order organizations, then
// memberships, is the lock order of every writer (member management must
// follow it). No row returns for a stale version, an account that is no
// active manager, or an unknown organization; the adapter reads the
// membership to tell them apart.
UpdateOrganizationProfile(ctx context.Context, arg UpdateOrganizationProfileParams) (Organization, error)
// Replaces the registration of an unverified account and advances the
// registration version in the same statement, so no caller can choose it.
// The version check rejects a writer that read an older row; a verified
// account never changes. The same statement deletes the C1 that the earlier
// registration of this account recorded, so the consent of an earlier
// registrant never stands for the new one; the new registration records its
// own C1 in the same transaction. A version conflict deletes nothing.
UpdateUserRegistration(ctx context.Context, arg UpdateUserRegistrationParams) (UpdateUserRegistrationRow, error)
// The times come from the database clock, never from a caller, and the update
// time cannot fall behind the stored times, so two jobs writing one review in
// either order keep the order check. The first evaluation time and the policy
// version stay; the guard trigger refuses a change of either.
UpsertAssessmentAttemptReview(ctx context.Context, arg UpsertAssessmentAttemptReviewParams) error
}
var _ Querier = (*Queries)(nil)