Files
OwnCord/Server/db/pgdbgen/plugins.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

176 lines
4.1 KiB
Go

//go:build postgres
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: plugins.sql
package pgdbgen
import (
"context"
)
const disablePlugin = `-- name: DisablePlugin :exec
UPDATE plugins SET enabled = FALSE WHERE id = $1
`
func (q *Queries) DisablePlugin(ctx context.Context, id int64) error {
_, err := q.db.Exec(ctx, disablePlugin, id)
return err
}
const enablePlugin = `-- name: EnablePlugin :exec
UPDATE plugins SET enabled = TRUE WHERE id = $1
`
func (q *Queries) EnablePlugin(ctx context.Context, id int64) error {
_, err := q.db.Exec(ctx, enablePlugin, id)
return err
}
const getPlugin = `-- name: GetPlugin :one
SELECT id, name, version, enabled, manifest_json, installed_at FROM plugins WHERE id = $1
`
func (q *Queries) GetPlugin(ctx context.Context, id int64) (Plugin, error) {
row := q.db.QueryRow(ctx, getPlugin, id)
var i Plugin
err := row.Scan(
&i.ID,
&i.Name,
&i.Version,
&i.Enabled,
&i.ManifestJson,
&i.InstalledAt,
)
return i, err
}
const getPluginByName = `-- name: GetPluginByName :one
SELECT id, name, version, enabled, manifest_json, installed_at FROM plugins WHERE name = $1
`
func (q *Queries) GetPluginByName(ctx context.Context, name string) (Plugin, error) {
row := q.db.QueryRow(ctx, getPluginByName, name)
var i Plugin
err := row.Scan(
&i.ID,
&i.Name,
&i.Version,
&i.Enabled,
&i.ManifestJson,
&i.InstalledAt,
)
return i, err
}
const installPlugin = `-- name: InstallPlugin :one
INSERT INTO plugins (name, version, manifest_json)
VALUES ($1, $2, $3)
ON CONFLICT (name) DO UPDATE
SET version = excluded.version,
manifest_json = excluded.manifest_json
RETURNING id
`
type InstallPluginParams struct {
Name string `json:"name"`
Version string `json:"version"`
ManifestJson string `json:"manifestJson"`
}
func (q *Queries) InstallPlugin(ctx context.Context, arg InstallPluginParams) (int64, error) {
row := q.db.QueryRow(ctx, installPlugin, arg.Name, arg.Version, arg.ManifestJson)
var id int64
err := row.Scan(&id)
return id, err
}
const listPlugins = `-- name: ListPlugins :many
SELECT id, name, version, enabled, manifest_json, installed_at FROM plugins ORDER BY name
`
func (q *Queries) ListPlugins(ctx context.Context) ([]Plugin, error) {
rows, err := q.db.Query(ctx, listPlugins)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Plugin{}
for rows.Next() {
var i Plugin
if err := rows.Scan(
&i.ID,
&i.Name,
&i.Version,
&i.Enabled,
&i.ManifestJson,
&i.InstalledAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const pluginKVDelete = `-- name: PluginKVDelete :exec
DELETE FROM plugin_kv WHERE plugin_id = $1 AND key = $2
`
type PluginKVDeleteParams struct {
PluginID int64 `json:"pluginId"`
Key string `json:"key"`
}
func (q *Queries) PluginKVDelete(ctx context.Context, arg PluginKVDeleteParams) error {
_, err := q.db.Exec(ctx, pluginKVDelete, arg.PluginID, arg.Key)
return err
}
const pluginKVGet = `-- name: PluginKVGet :one
SELECT value FROM plugin_kv WHERE plugin_id = $1 AND key = $2
`
type PluginKVGetParams struct {
PluginID int64 `json:"pluginId"`
Key string `json:"key"`
}
func (q *Queries) PluginKVGet(ctx context.Context, arg PluginKVGetParams) ([]byte, error) {
row := q.db.QueryRow(ctx, pluginKVGet, arg.PluginID, arg.Key)
var value []byte
err := row.Scan(&value)
return value, err
}
const pluginKVSet = `-- name: PluginKVSet :exec
INSERT INTO plugin_kv (plugin_id, key, value)
VALUES ($1, $2, $3)
ON CONFLICT (plugin_id, key) DO UPDATE SET value = excluded.value
`
type PluginKVSetParams struct {
PluginID int64 `json:"pluginId"`
Key string `json:"key"`
Value []byte `json:"value"`
}
func (q *Queries) PluginKVSet(ctx context.Context, arg PluginKVSetParams) error {
_, err := q.db.Exec(ctx, pluginKVSet, arg.PluginID, arg.Key, arg.Value)
return err
}
const uninstallPlugin = `-- name: UninstallPlugin :exec
DELETE FROM plugins WHERE id = $1
`
func (q *Queries) UninstallPlugin(ctx context.Context, id int64) error {
_, err := q.db.Exec(ctx, uninstallPlugin, id)
return err
}