2
0

Merge branch 'scheme-agnostic-uri' of https://github.com/sean-/pgx into sean--scheme-agnostic-uri

This commit is contained in:
Jack Christensen
2018-02-03 11:43:46 -06:00
+1 -1
View File
@@ -809,7 +809,7 @@ func ParseDSN(s string) (ConnConfig, error) {
// ParseConnectionString parses either a URI or a DSN connection string.
// see ParseURI and ParseDSN for details.
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 ParseDSN(s)