func (db *DB) Close(ctx context.Context, t testing.TB) {
	cfg, err := pgxpool.ParseConfig(db.dsn)
	if err != nil {
		panic(err) // Should never happen.
	}
	conn, err := pgx.ConnectConfig(ctx, cfg.ConnConfig)
	if err != nil {
		t.Fatal(err)
	}
	defer conn.Close(ctx)

	if _, err := conn.Exec(ctx, killConnections, db.cfg.ConnConfig.Database); err != nil {
		t.Error(err)
	}

	if _, err := conn.Exec(ctx, fmt.Sprintf(dropDatabase, db.cfg.ConnConfig.Database)); err != nil {
		t.Error(err)
	}
	if _, err := conn.Exec(ctx, fmt.Sprintf(dropRole, db.cfg.ConnConfig.User)); err != nil {
		t.Error(err)
	}
	db.cfg = nil
}
// Close tears down the created database.
Close tears down the created database.
// Close tears down the created database .
func (db *DB) Close(ctx context.Context, t testing.TB) {
	cfg, err := pgxpool.ParseConfig(db.dsn)
	if err != nil {
		panic(err) 
	}
	conn, err := pgx.ConnectConfig(ctx, cfg.ConnConfig)
	if err != nil {
		t.Fatal(err)
	}
	defer conn.Close(ctx)
	if _, err := conn.Exec(ctx, killConnections, db.cfg.ConnConfig.Database); err != nil {
		t.Error(err)
	}
	if _, err := conn.Exec(ctx, fmt.Sprintf(dropDatabase, db.cfg.ConnConfig.Database)); err != nil {
		t.Error(err)
	}
	if _, err := conn.Exec(ctx, fmt.Sprintf(dropRole, db.cfg.ConnConfig.User)); err != nil {
		t.Error(err)
	}
	db.cfg = nil
}
func ( db * DB ) Close ( ctx context . Context , t testing . TB ) { cfg , err := pgxpool . ParseConfig ( db . dsn ) if err != nil { panic ( err ) } conn , err := pgx . ConnectConfig ( ctx , cfg . ConnConfig ) if err != nil { t . Fatal ( err ) } defer conn . Close ( ctx ) if _ , err := conn . Exec ( ctx , killConnections , db . cfg . ConnConfig . Database ) ; err != nil { t . Error ( err ) } if _ , err := conn . Exec ( ctx , fmt . Sprintf ( dropDatabase , db . cfg . ConnConfig . Database ) ) ; err != nil { t . Error ( err ) } if _ , err := conn . Exec ( ctx , fmt . Sprintf ( dropRole , db . cfg . ConnConfig . User ) ) ; err != nil { t . Error ( err ) } db . cfg = nil }
Close tears down the created database.
Close tears down the created database .
// Should never happen.