mirror of https://github.com/jackc/pgx.git
Merge branch 'sean--scheme-agnostic-uri'
commit
56a5cb4e5d
2
conn.go
2
conn.go
|
@ -809,7 +809,7 @@ func ParseDSN(s string) (ConnConfig, error) {
|
||||||
// ParseConnectionString parses either a URI or a DSN connection string.
|
// ParseConnectionString parses either a URI or a DSN connection string.
|
||||||
// see ParseURI and ParseDSN for details.
|
// see ParseURI and ParseDSN for details.
|
||||||
func ParseConnectionString(s string) (ConnConfig, error) {
|
func ParseConnectionString(s string) (ConnConfig, error) {
|
||||||
if strings.HasPrefix(s, "postgres://") || strings.HasPrefix(s, "postgresql://") {
|
if u, err := url.Parse(s); err == nil && u.Scheme != "" {
|
||||||
return ParseURI(s)
|
return ParseURI(s)
|
||||||
}
|
}
|
||||||
return ParseDSN(s)
|
return ParseDSN(s)
|
||||||
|
|
Loading…
Reference in New Issue