package db_test import ( "database/sql" "log" "os" "testing" db "git.nochill.in/nochill/hiling_go/db/sqlc" "git.nochill.in/nochill/hiling_go/util" _ "github.com/lib/pq" ) var testQueries *db.Queries var testDB *sql.DB func TestMain(m *testing.M) { var err error config, err := util.LoadConfig("../../..") if err != nil { log.Fatal("cannot load config: ", err) } testDB, err = sql.Open(config.DBDriver, config.DBSourceTest) if err != nil { log.Fatal("cannot connect db: ", err) } testQueries = db.New(testDB) os.Exit(m.Run()) }