mirror of https://github.com/jackc/pgx.git
Add host query parameter to support unix sockets
Currently there is no way to specify unix sockets in the connection url. This patch adds a `host` query parameter that allows to set the path.pull/473/head
parent
20eaa7963b
commit
3410ad9122
5
conn.go
5
conn.go
|
@ -782,6 +782,11 @@ func ParseURI(uri string) (ConnConfig, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
if k == "host" {
|
||||
cp.Host = v[0]
|
||||
continue
|
||||
}
|
||||
|
||||
cp.RuntimeParams[k] = v[0]
|
||||
}
|
||||
if cp.Password == "" {
|
||||
|
|
13
conn_test.go
13
conn_test.go
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue