// Driver is the Postgres database driver.
type Driver struct{}
// Open opens a new connection to the database. name is a connection string.
// Most users should only use it through database/sql package from the standard
// library.
func (d Driver) Open(name string) (driver.Conn, error) {
return Open(name)
}
func init() {
sql.Register("postgres", &Driver{})
}
Default driver do not implements DriverContext:
as a result, when src/database/sql/sql.go do
ci, err := db.connector.Connect(ctx)
it uses default connector which ignore context:
It results in connection hanging indefinitelly and leaking ports if database become unreachable during connection.