Open bilal-psychplus opened 6 months ago
you should change pgx.Conn to pgxpool.Pool, like below:
package db
import (
"context"
"log"
"os"
"testing"
"github.com/jackc/pgx/v5/pgxpool"
_ "github.com/lib/pq"
)
const (
dbSource = "postgresql://root:secret@localhost:5432/simple_bank?sslmode=disable"
)
var testQueries *Queries
var testDB *pgxpool.Pool
func TestMain(m *testing.M) {
ctx := context.Background()
var err error
testDB, err = pgxpool.New(ctx, dbSource)
if err != nil {
log.Fatal("Can not connect to the db: ", err)
}
defer testDB.Close()
testQueries = New(testDB)
os.Exit(m.Run())
}
This my storage.go file
And i am getting the following errors
What am i missing here.