mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-20 14:32:54 +00:00
* 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
27 lines
584 B
Go
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...)
|
|
}
|