Files
beacon-server/db/statement_capture_test.go
T
MrAlders0n c27f721dd2 Route search hop order, node-types split, bounded migration lock waits (#234)
* perf(routes): keep hop_count indexes out of route search order

* perf(stats): count node types without node_iatas when unfiltered

* perf(db): drop the unused idx_known_routes_iata_last_seen

* fix(db): bound boot migration lock waits and name the blockers

* test(db): pin the lock-retry rebuild and tidy comments
2026-10-19 03:58:37 -04:00

27 lines
584 B
Go

// Copyright 2026 Beacon Contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
package db
import (
"context"
"strings"
"github.com/jackc/pgx/v5"
)
// statementCapture records the SQL and args of sqlc statements whose name starts with name, for EXPLAIN.
type statementCapture struct {
pgx.Tx
name string
statement string
args []any
}
func (c *statementCapture) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) {
if strings.Contains(sql, "-- name: "+c.name) {
c.statement, c.args = sql, args
}
return c.Tx.Query(ctx, sql, args...)
}