mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
- Generate Server/db/dbgen/{events,plugins}.sql.go and full Server/db/pgdbgen/ (//go:build postgres gated)
- Implement PostgresStore EventStore and PluginStore methods in store/postgres.go
- Wire plugin host_events.go EventSink into hub broadcast path (SetPluginEventSink)
- Wire host_commands.go slash-command dispatcher: chat_command V1 handler + hub.SetPluginRegistry
- Add handlers_command.go + handlers_command_test.go for plugin slash-command dispatch
- Add reconnect_db_test.go: TestReconnect_BufferMiss_FallsBackToDBTier (cold-tier DB replay)
- Add otel-up/otel-down Makefile targets; docker-compose.otel.yml + prometheus.dev.yml
- Update PHASE_BC_LOCAL_TODO.md: mark in-session items complete; document remaining network-blocked steps
- Minor fixes: channel_handler access-control, router plugin handler wiring, service span instrumentation
198 lines
12 KiB
Go
198 lines
12 KiB
Go
//go:build postgres
|
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
|
|
package pgdbgen
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type Querier interface {
|
|
// PostgreSQL variants of the sqlite reactions queries.
|
|
AddReaction(ctx context.Context, arg AddReactionParams) error
|
|
AdminUpdateChannel(ctx context.Context, arg AdminUpdateChannelParams) error
|
|
ArchiveChannel(ctx context.Context, arg ArchiveChannelParams) error
|
|
BanUser(ctx context.Context, arg BanUserParams) error
|
|
// PostgreSQL variants of the sqlite user block queries.
|
|
// `INSERT OR IGNORE` becomes `INSERT ... ON CONFLICT DO NOTHING`.
|
|
BlockUser(ctx context.Context, arg BlockUserParams) error
|
|
CleanupExpiredLockouts(ctx context.Context, expiresAt pgtype.Timestamptz) error
|
|
ClearAllVoiceStates(ctx context.Context) error
|
|
ClearVoiceState(ctx context.Context, userID int64) error
|
|
CloseDM(ctx context.Context, arg CloseDMParams) error
|
|
CountActiveCameras(ctx context.Context, channelID int64) (int64, error)
|
|
CountActiveInvites(ctx context.Context) (int64, error)
|
|
CountActiveMessages(ctx context.Context) (int64, error)
|
|
CountChannels(ctx context.Context) (int64, error)
|
|
CountUsers(ctx context.Context) (int64, error)
|
|
CountUsersWithoutTOTP(ctx context.Context) (int64, error)
|
|
// PostgreSQL variants of the sqlite attachments queries.
|
|
CreateAttachment(ctx context.Context, arg CreateAttachmentParams) error
|
|
CreateChannel(ctx context.Context, arg CreateChannelParams) (int64, error)
|
|
// PostgreSQL variants of the sqlite invites queries.
|
|
// The expiry check uses native timestamp comparison instead of sqlite's
|
|
// strftime('%s', …) trick.
|
|
CreateInvite(ctx context.Context, arg CreateInviteParams) error
|
|
// PostgreSQL variants of the sqlite messages queries.
|
|
// `deleted = 0/1` and `pinned = 0/1` become FALSE/TRUE (columns are BOOLEAN).
|
|
// The FTS search queries are NOT included here: on postgres, messages.fts is
|
|
// a tsvector column with a GIN index (see migrations/postgres/001_initial_schema.sql)
|
|
// and FTS queries are hand-written in the postgres-specific store dispatch,
|
|
// mirroring how sqlite's FTS5 queries live in message_queries.go.
|
|
CreateMessage(ctx context.Context, arg CreateMessageParams) (int64, error)
|
|
CreateUser(ctx context.Context, arg CreateUserParams) (int64, error)
|
|
DeleteAttachment(ctx context.Context, id string) error
|
|
DeleteChannel(ctx context.Context, id int64) error
|
|
DeleteChannelPermission(ctx context.Context, arg DeleteChannelPermissionParams) error
|
|
// Use native timestamp comparison instead of sqlite's strftime trick.
|
|
DeleteExpiredSessions(ctx context.Context) error
|
|
DeleteLockout(ctx context.Context, key string) error
|
|
// Postgres timestamptz comparison — the caller passes a wall-clock time.
|
|
DeleteOrphanedAttachments(ctx context.Context, uploadedAt pgtype.Timestamptz) ([]string, error)
|
|
DeleteOtherSessions(ctx context.Context, arg DeleteOtherSessionsParams) (int64, error)
|
|
DeleteSessionByID(ctx context.Context, arg DeleteSessionByIDParams) error
|
|
DeleteSessionByToken(ctx context.Context, token string) error
|
|
DisablePlugin(ctx context.Context, id int64) error
|
|
EditMessageContent(ctx context.Context, arg EditMessageContentParams) error
|
|
EnableCameraIfUnderLimit(ctx context.Context, arg EnableCameraIfUnderLimitParams) (int64, error)
|
|
EnablePlugin(ctx context.Context, id int64) error
|
|
// Delete all but the N most recent sessions for a user. Postgres replaces
|
|
// sqlite's `LIMIT -1 OFFSET ?` with `OFFSET $2`.
|
|
EvictOldestSessions(ctx context.Context, arg EvictOldestSessionsParams) error
|
|
FindExistingDMChannel(ctx context.Context, arg FindExistingDMChannelParams) (int64, error)
|
|
ForceLogoutUser(ctx context.Context, userID int64) error
|
|
GetAllSettings(ctx context.Context) ([]Setting, error)
|
|
GetAllVoiceStates(ctx context.Context) ([]GetAllVoiceStatesRow, error)
|
|
GetAttachmentByID(ctx context.Context, id string) (GetAttachmentByIDRow, error)
|
|
GetAttachmentWithChannel(ctx context.Context, id string) (GetAttachmentWithChannelRow, error)
|
|
GetAuditLog(ctx context.Context, arg GetAuditLogParams) ([]GetAuditLogRow, error)
|
|
GetChannel(ctx context.Context, id int64) (GetChannelRow, error)
|
|
GetChannelPermission(ctx context.Context, arg GetChannelPermissionParams) (GetChannelPermissionRow, error)
|
|
GetChannelUnreadCounts(ctx context.Context, userID int64) ([]GetChannelUnreadCountsRow, error)
|
|
GetChannelVoiceStates(ctx context.Context, channelID int64) ([]GetChannelVoiceStatesRow, error)
|
|
GetDMParticipantIDs(ctx context.Context, channelID int64) ([]int64, error)
|
|
GetDefaultRole(ctx context.Context) (Role, error)
|
|
GetEventsSince(ctx context.Context, arg GetEventsSinceParams) ([]GetEventsSinceRow, error)
|
|
GetInvite(ctx context.Context, code string) (GetInviteRow, error)
|
|
GetLatestMessageID(ctx context.Context, channelID int64) (int64, error)
|
|
GetMaxEventSeq(ctx context.Context) (int64, error)
|
|
GetMessage(ctx context.Context, id int64) (GetMessageRow, error)
|
|
GetMessagesByChannel(ctx context.Context, arg GetMessagesByChannelParams) ([]GetMessagesByChannelRow, error)
|
|
GetMessagesByChannelBeforeCursor(ctx context.Context, arg GetMessagesByChannelBeforeCursorParams) ([]GetMessagesByChannelBeforeCursorRow, error)
|
|
GetMessagesForAPI(ctx context.Context, arg GetMessagesForAPIParams) ([]GetMessagesForAPIRow, error)
|
|
GetMessagesForAPIBeforeCursor(ctx context.Context, arg GetMessagesForAPIBeforeCursorParams) ([]GetMessagesForAPIBeforeCursorRow, error)
|
|
GetPinnedMessageRows(ctx context.Context, channelID int64) ([]GetPinnedMessageRowsRow, error)
|
|
GetPlugin(ctx context.Context, id int64) (Plugin, error)
|
|
GetPluginByName(ctx context.Context, name string) (Plugin, error)
|
|
GetReactionCounts(ctx context.Context, messageID int64) ([]GetReactionCountsRow, error)
|
|
// PostgreSQL variants of the sqlite roles queries.
|
|
// `is_default = 1` becomes `is_default = TRUE` since the column is BOOLEAN.
|
|
GetRoleByID(ctx context.Context, id int64) (Role, error)
|
|
GetRoleChannelPermissions(ctx context.Context, roleID int64) ([]GetRoleChannelPermissionsRow, error)
|
|
GetRoleForUser(ctx context.Context, id int64) (Role, error)
|
|
GetSessionByTokenHash(ctx context.Context, token string) (Session, error)
|
|
GetSessionWithBanStatus(ctx context.Context, token string) (GetSessionWithBanStatusRow, error)
|
|
GetSetting(ctx context.Context, key string) (string, error)
|
|
GetUserByID(ctx context.Context, id int64) (User, error)
|
|
// PostgreSQL variants of the sqlite users queries.
|
|
// Differences from sqlite:
|
|
// - `?` -> `$1`, `$2`, …
|
|
// - `COLLATE NOCASE` -> removed; the `username` column is CITEXT.
|
|
// - `datetime('now')` -> `NOW()`
|
|
// - `banned = 0/1` -> `banned = FALSE/TRUE` (column is BOOLEAN)
|
|
// - `:execresult INSERT` -> `:one ... RETURNING id` (pgx has no LastInsertId)
|
|
GetUserByUsername(ctx context.Context, username string) (User, error)
|
|
// For the "last message at" and "last message content" columns, sqlite
|
|
// COALESCEs to '' (empty string). Postgres TIMESTAMPTZ cannot COALESCE to an
|
|
// empty string, so we COALESCE to the dm_open_state.opened_at fallback and
|
|
// leave conversion to the store wrapper.
|
|
GetUserDMChannels(ctx context.Context, arg GetUserDMChannelsParams) ([]GetUserDMChannelsRow, error)
|
|
GetUserSessions(ctx context.Context, userID int64) ([]Session, error)
|
|
GetUserVoiceState(ctx context.Context, userID int64) (GetUserVoiceStateRow, error)
|
|
GetUserWithRole(ctx context.Context, id int64) (GetUserWithRoleRow, error)
|
|
// PostgreSQL variants of the sqlite DM queries.
|
|
// InsertDMChannel: sqlite uses :execresult (LastInsertId); postgres uses
|
|
// :one with RETURNING id.
|
|
// `INSERT OR IGNORE` becomes `INSERT ... ON CONFLICT DO NOTHING`.
|
|
InsertDMChannel(ctx context.Context) (int64, error)
|
|
InsertDMOpenState(ctx context.Context, arg InsertDMOpenStateParams) error
|
|
InsertDMParticipants(ctx context.Context, arg InsertDMParticipantsParams) error
|
|
// PostgreSQL variants of the sqlite sessions queries.
|
|
InsertSession(ctx context.Context, arg InsertSessionParams) (int64, error)
|
|
InstallPlugin(ctx context.Context, arg InstallPluginParams) (int64, error)
|
|
IsBlocked(ctx context.Context, arg IsBlockedParams) (int32, error)
|
|
IsDMParticipant(ctx context.Context, arg IsDMParticipantParams) (int64, error)
|
|
IsEitherBlocked(ctx context.Context, arg IsEitherBlockedParams) (int32, error)
|
|
// PostgreSQL variants of the sqlite voice queries.
|
|
// voice_states boolean columns (muted, deafened, speaking, camera,
|
|
// screenshare) use FALSE/TRUE instead of 0/1.
|
|
JoinVoiceChannel(ctx context.Context, arg JoinVoiceChannelParams) error
|
|
JoinVoiceChannelIfCapacity(ctx context.Context, arg JoinVoiceChannelIfCapacityParams) (int64, error)
|
|
LeaveVoiceChannel(ctx context.Context, userID int64) error
|
|
LeaveVoiceChannelIfMatch(ctx context.Context, arg LeaveVoiceChannelIfMatchParams) (int64, error)
|
|
LinkAttachmentToMessage(ctx context.Context, arg LinkAttachmentToMessageParams) (int64, error)
|
|
ListAllUsers(ctx context.Context, arg ListAllUsersParams) ([]ListAllUsersRow, error)
|
|
// PostgreSQL variants of the sqlite channels queries.
|
|
ListChannels(ctx context.Context) ([]ListChannelsRow, error)
|
|
ListInvites(ctx context.Context) ([]ListInvitesRow, error)
|
|
ListMembers(ctx context.Context) ([]ListMembersRow, error)
|
|
ListPlugins(ctx context.Context) ([]Plugin, error)
|
|
ListRoles(ctx context.Context) ([]Role, error)
|
|
ListUserSessions(ctx context.Context, userID int64) ([]Session, error)
|
|
LoadActiveLockouts(ctx context.Context, expiresAt pgtype.Timestamptz) ([]RateLockout, error)
|
|
LogAudit(ctx context.Context, arg LogAuditParams) error
|
|
OpenDM(ctx context.Context, arg OpenDMParams) error
|
|
// seq is supplied by the hub so the row seq matches the wrapped-payload seq.
|
|
// The schema's BIGSERIAL still owns the id column for inserts that omit seq,
|
|
// but PersistEvent always supplies an explicit value.
|
|
PersistEvent(ctx context.Context, arg PersistEventParams) error
|
|
PluginKVDelete(ctx context.Context, arg PluginKVDeleteParams) error
|
|
PluginKVGet(ctx context.Context, arg PluginKVGetParams) ([]byte, error)
|
|
PluginKVSet(ctx context.Context, arg PluginKVSetParams) error
|
|
PruneEventsOlderThan(ctx context.Context, createdAt pgtype.Timestamptz) (int64, error)
|
|
RemoveReaction(ctx context.Context, arg RemoveReactionParams) (int64, error)
|
|
ResetAllUserStatuses(ctx context.Context) error
|
|
RevokeInvite(ctx context.Context, code string) error
|
|
SetChannelMixingThreshold(ctx context.Context, arg SetChannelMixingThresholdParams) error
|
|
SetChannelSlowMode(ctx context.Context, arg SetChannelSlowModeParams) error
|
|
SetChannelVoiceMaxUsers(ctx context.Context, arg SetChannelVoiceMaxUsersParams) error
|
|
SetChannelVoiceMaxVideo(ctx context.Context, arg SetChannelVoiceMaxVideoParams) error
|
|
SetChannelVoiceQuality(ctx context.Context, arg SetChannelVoiceQualityParams) error
|
|
SetMessagePinned(ctx context.Context, arg SetMessagePinnedParams) (int64, error)
|
|
SetSetting(ctx context.Context, arg SetSettingParams) error
|
|
SoftDeleteMessage(ctx context.Context, id int64) error
|
|
TouchSession(ctx context.Context, token string) error
|
|
UnbanUser(ctx context.Context, id int64) error
|
|
UnblockUser(ctx context.Context, arg UnblockUserParams) error
|
|
UninstallPlugin(ctx context.Context, id int64) error
|
|
UpdateChannel(ctx context.Context, arg UpdateChannelParams) error
|
|
UpdateReadState(ctx context.Context, arg UpdateReadStateParams) error
|
|
UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
|
|
// PostgreSQL variants of the sqlite profile queries.
|
|
// UpdateUserProfile uses :execrows because postgres has no LastInsertId;
|
|
// the caller checks rows-affected for existence.
|
|
UpdateUserProfile(ctx context.Context, arg UpdateUserProfileParams) (int64, error)
|
|
UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) error
|
|
UpdateUserStatus(ctx context.Context, arg UpdateUserStatusParams) error
|
|
UpdateUserTOTPSecret(ctx context.Context, arg UpdateUserTOTPSecretParams) error
|
|
UpdateVoiceCamera(ctx context.Context, arg UpdateVoiceCameraParams) error
|
|
UpdateVoiceDeafen(ctx context.Context, arg UpdateVoiceDeafenParams) error
|
|
UpdateVoiceMute(ctx context.Context, arg UpdateVoiceMuteParams) error
|
|
UpdateVoiceScreenshare(ctx context.Context, arg UpdateVoiceScreenshareParams) error
|
|
UpdateVoiceSpeaking(ctx context.Context, arg UpdateVoiceSpeakingParams) error
|
|
UpsertChannelPermission(ctx context.Context, arg UpsertChannelPermissionParams) error
|
|
// PostgreSQL variants of the sqlite rate-lockout queries.
|
|
// `INSERT OR REPLACE` becomes `INSERT ... ON CONFLICT (key) DO UPDATE`.
|
|
UpsertLockout(ctx context.Context, arg UpsertLockoutParams) error
|
|
UseInviteAtomic(ctx context.Context, code string) (int64, error)
|
|
// PostgreSQL variants of the sqlite admin queries.
|
|
UserCount(ctx context.Context) (int64, error)
|
|
}
|
|
|
|
var _ Querier = (*Queries)(nil)
|