Merge pull request #473 from Mic92/unix-sockets

Add path query parameter to support unix sockets
pull/479/head
Jack Christensen 2018-11-05 18:58:19 -06:00 committed by GitHub
commit c10ee2b7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -774,6 +774,11 @@ func ParseURI(uri string) (ConnConfig, error) {
continue
}
if k == "host" {
cp.Host = v[0]
continue
}
cp.RuntimeParams[k] = v[0]
}
if cp.Password == "" {

View File

@ -458,6 +458,19 @@ func TestParseURI(t *testing.T) {
},
},
},
{
url: "postgres:///foo?host=/tmp",
connParams: pgx.ConnConfig{
Host: "/tmp",
Database: "foo",
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
UseFallbackTLS: true,
FallbackTLSConfig: nil,
RuntimeParams: map[string]string{},
},
},
}
for i, tt := range tests {