Merge branch 'sean--scheme-agnostic-uri'

pull/389/head
Jack Christensen 2018-02-03 11:44:09 -06:00
commit 56a5cb4e5d
1 changed files with 1 additions and 1 deletions

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)