123 lines
7.9 KiB
Go
123 lines
7.9 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 {
|
|
// 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) (EmailToken, error)
|
|
// Deletes one batch of accounts that stayed unverified since before cutoff,
|
|
// oldest first, with their tokens and sessions. Every lock is taken with SKIP
|
|
// LOCKED, so the statement never waits: an account whose row is locked, for
|
|
// example by a re-registration or a token insert, is skipped, and so is an
|
|
// account with any token or session row locked, for example by a
|
|
// confirmation that consumed a token. 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 and session row visible to the
|
|
// statement was locked above.
|
|
DeleteUnverifiedUsersRegisteredBefore(ctx context.Context, arg DeleteUnverifiedUsersRegisteredBeforeParams) (int64, error)
|
|
GetActiveSessionByTokenHash(ctx context.Context, arg GetActiveSessionByTokenHashParams) (Session, 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)
|
|
// Explains why ConsumeEmailToken matched no row.
|
|
GetEmailTokenState(ctx context.Context, arg GetEmailTokenStateParams) (GetEmailTokenStateRow, error)
|
|
GetLatestPolicyVersion(ctx context.Context, policyKey string) (PolicyVersion, 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)
|
|
GetUserByEmailNormalized(ctx context.Context, emailNormalized string) (User, error)
|
|
GetUserByID(ctx context.Context, id pgtype.UUID) (User, 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
|
|
InsertEmailToken(ctx context.Context, arg InsertEmailTokenParams) 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)
|
|
InsertSession(ctx context.Context, arg InsertSessionParams) error
|
|
InsertUser(ctx context.Context, arg InsertUserParams) error
|
|
InvalidateActiveEmailTokens(ctx context.Context, arg InvalidateActiveEmailTokensParams) (int64, 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)
|
|
// 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)
|
|
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)
|
|
RevokeSession(ctx context.Context, arg RevokeSessionParams) (int64, error)
|
|
RevokeUserSessions(ctx context.Context, arg RevokeUserSessionsParams) (int64, 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
|
|
// 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)
|
|
// 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.
|
|
UpdateUserRegistration(ctx context.Context, arg UpdateUserRegistrationParams) (User, error)
|
|
}
|
|
|
|
var _ Querier = (*Queries)(nil)
|