sql driver to pgx driver

This commit is contained in:
2025-05-15 14:47:46 -04:00
parent ab0e40c695
commit f1bbd06ef7
7 changed files with 27 additions and 186 deletions

View File

@@ -2,19 +2,19 @@ package test
import (
"context"
"database/sql"
"log/slog"
"testing"
"time"
"gitea.michaelthomson.dev/mthomson/habits/internal/migrate"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/postgres"
"github.com/testcontainers/testcontainers-go/wait"
)
type TestDatabase struct {
Db *sql.DB
Db *pgxpool.Pool
container testcontainers.Container
}
@@ -43,7 +43,7 @@ func NewTestDatabase(tb testing.TB) *TestDatabase {
}
// create db pool
db, err := sql.Open("pgx", connectionString)
db, err := pgxpool.New(context.Background(), connectionString)
if err != nil {
tb.Fatalf("Failed to open db pool: %v", err)
}