2
0

[stdlib] Add support for creating a DB from pgx.Pool

Also the configuration used in the Conn structure (used to implement the
driver.Conn interface) stores a ConnConfig which is used only for determining
if the Connection should be used with Simple Protocol or not.
This commit is contained in:
fzerorubigd
2019-03-28 16:31:55 +01:00
parent 31500c15b3
commit 0b62f832b0
2 changed files with 68 additions and 1 deletions
+8 -1
View File
@@ -16,5 +16,12 @@ func openDB(t *testing.T) *sql.DB {
t.Fatalf("pgx.ParseConnectionString failed: %v", err)
}
return stdlib.OpenDB(config)
pool, err := pgx.NewConnPool(pgx.ConnPoolConfig{
ConnConfig: config,
})
if err != nil {
t.Fatalf("pgx.ParseConnectionString failed: %v", err)
}
return stdlib.OpenDBFromPool(pool)
}