Files
OwnCord/Server/db/pgdbgen/blocks.sql.go
T
J3vb 9116a880a3 feat(phase-bc): pass 5 — pgdbgen, postgres EventStore/PluginStore, plugin hub wiring, OTel stack, reconnect DB tier
- 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
2026-04-06 22:48:59 +02:00

87 lines
2.2 KiB
Go

//go:build postgres
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: blocks.sql
package pgdbgen
import (
"context"
)
const blockUser = `-- name: BlockUser :exec
INSERT INTO user_blocks (blocker_id, blocked_id) VALUES ($1, $2)
ON CONFLICT (blocker_id, blocked_id) DO NOTHING
`
type BlockUserParams struct {
BlockerID int64 `json:"blockerId"`
BlockedID int64 `json:"blockedId"`
}
// PostgreSQL variants of the sqlite user block queries.
// `INSERT OR IGNORE` becomes `INSERT ... ON CONFLICT DO NOTHING`.
func (q *Queries) BlockUser(ctx context.Context, arg BlockUserParams) error {
_, err := q.db.Exec(ctx, blockUser, arg.BlockerID, arg.BlockedID)
return err
}
const isBlocked = `-- name: IsBlocked :one
SELECT 1 FROM user_blocks WHERE blocker_id = $1 AND blocked_id = $2 LIMIT 1
`
type IsBlockedParams struct {
BlockerID int64 `json:"blockerId"`
BlockedID int64 `json:"blockedId"`
}
func (q *Queries) IsBlocked(ctx context.Context, arg IsBlockedParams) (int32, error) {
row := q.db.QueryRow(ctx, isBlocked, arg.BlockerID, arg.BlockedID)
var column_1 int32
err := row.Scan(&column_1)
return column_1, err
}
const isEitherBlocked = `-- name: IsEitherBlocked :one
SELECT 1 FROM user_blocks
WHERE (blocker_id = $1 AND blocked_id = $2)
OR (blocker_id = $3 AND blocked_id = $4)
LIMIT 1
`
type IsEitherBlockedParams struct {
BlockerID int64 `json:"blockerId"`
BlockedID int64 `json:"blockedId"`
BlockerID_2 int64 `json:"blockerId2"`
BlockedID_2 int64 `json:"blockedId2"`
}
func (q *Queries) IsEitherBlocked(ctx context.Context, arg IsEitherBlockedParams) (int32, error) {
row := q.db.QueryRow(ctx, isEitherBlocked,
arg.BlockerID,
arg.BlockedID,
arg.BlockerID_2,
arg.BlockedID_2,
)
var column_1 int32
err := row.Scan(&column_1)
return column_1, err
}
const unblockUser = `-- name: UnblockUser :exec
DELETE FROM user_blocks WHERE blocker_id = $1 AND blocked_id = $2
`
type UnblockUserParams struct {
BlockerID int64 `json:"blockerId"`
BlockedID int64 `json:"blockedId"`
}
func (q *Queries) UnblockUser(ctx context.Context, arg UnblockUserParams) error {
_, err := q.db.Exec(ctx, unblockUser, arg.BlockerID, arg.BlockedID)
return err
}