2
0

enable sql.Open to support both DSN and URI based connection strings

This commit is contained in:
James Lawrence
2017-03-31 20:02:17 -04:00
committed by Jack Christensen
parent 09078d2470
commit c5d247830c
3 changed files with 236 additions and 1 deletions
+8 -1
View File
@@ -7,6 +7,13 @@
// return err
// }
//
// Or from a DSN string.
//
// db, err := sql.Open("pgx", "user=postgres password=secret host=localhost port=5432 database=pgx_test sslmode=disable")
// if err != nil {
// return err
// }
//
// Or a normal pgx connection pool can be established and the database/sql
// connection can be created through stdlib.OpenFromConnPool(). This allows
// more control over the connection process (such as TLS), more control
@@ -99,7 +106,7 @@ func (d *Driver) Open(name string) (driver.Conn, error) {
return &Conn{conn: conn, pool: d.Pool}, nil
}
connConfig, err := pgx.ParseURI(name)
connConfig, err := pgx.ParseConnectionString(name)
if err != nil {
return nil, err
}