Private
Public Access
1
0
Files
data-api/ntpdb/dbconn.go
Ask Bjørn Hansen c9481d12c6
All checks were successful
continuous-integration/drone/push Build is passing
feat(db): migrate from MySQL to PostgreSQL
Replace MySQL driver with pgx/v5 and pgxpool:
- Update sqlc to use postgresql engine
- Convert query.sql to PostgreSQL syntax ($1 params, CASE WHEN,
  ANY() arrays)
- Replace sql.DB with pgxpool.Pool throughout
- Change nullable types from sql.Null* to pgtype.*
- Update ID types from uint32 to int64 for PostgreSQL compatibility
- Delete MySQL-specific dynamic_connect.go
- Add opentelemetry.gowrap template for tracing
2025-11-29 10:59:15 -08:00

16 lines
446 B
Go

package ntpdb
//go:generate go tool github.com/hexdigest/gowrap/cmd/gowrap gen -t ./opentelemetry.gowrap -g -i QuerierTx -p . -o otel.go
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
"go.ntppool.org/common/database/pgdb"
)
// OpenDB opens a PostgreSQL connection pool using the specified config file
func OpenDB(ctx context.Context, configFile string) (*pgxpool.Pool, error) {
return pgdb.OpenPoolWithConfigFile(ctx, configFile)
}