sql driver to pgx driver
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user