1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Add unix socket connection by url stirng. (#1511)

* add unix connectin by url string
This commit is contained in:
Roman Suvorov
2020-09-28 15:26:08 +03:00
committed by GitHub
parent 3e42145a26
commit d31cf6c328
2 changed files with 81 additions and 10 deletions

View File

@ -66,6 +66,30 @@ func TestParseURL(t *testing.T) {
0, false, nil,
"foo", "bar",
},
{
"unix:///tmp/redis.sock",
"/tmp/redis.sock",
0, false, nil,
"", "",
},
{
"unix://foo:bar@/tmp/redis.sock",
"/tmp/redis.sock",
0, false, nil,
"foo", "bar",
},
{
"unix://foo:bar@/tmp/redis.sock?db=3",
"/tmp/redis.sock",
3, false, nil,
"foo", "bar",
},
{
"unix://foo:bar@/tmp/redis.sock?db=test",
"/tmp/redis.sock",
0, false, errors.New("invalid reids database number: strconv.Atoi: parsing \"test\": invalid syntax"),
"", "",
},
{
"redis://localhost/?abc=123",
"",