Skip to content

Commit

Permalink
expose host:port the client is listening at (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
xh3b4sd committed Sep 30, 2023
1 parent 38e4c7d commit fcc618c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package redigo

import (
"github.com/gomodule/redigo/redis"

"github.com/xh3b4sd/redigo/pkg/backup"
"github.com/xh3b4sd/redigo/pkg/locker"
"github.com/xh3b4sd/redigo/pkg/pubsub"
Expand All @@ -18,6 +17,8 @@ type Interface interface {
Purge() error
Redis(fun func(con redis.Conn) error) error

Listen() string

Backup() backup.Interface
Locker() locker.Interface
PubSub() pubsub.Interface
Expand Down
6 changes: 6 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ConfigLocker struct {
}

type Client struct {
add string
bac backup.Interface
loc locker.Interface
poo *redis.Pool
Expand Down Expand Up @@ -155,6 +156,7 @@ func New(con Config) (*Client, error) {
}

c := &Client{
add: con.Address,
bac: bac,
loc: loc,
poo: con.Pool,
Expand Down Expand Up @@ -228,6 +230,10 @@ func (c *Client) Redis(fun func(con redis.Conn) error) error {
return nil
}

func (c *Client) Listen() string {
return c.add
}

func (c *Client) Backup() backup.Interface {
return c.bac
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/fake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (c *Client) Redis(fun func(con redis.Conn) error) error {
return nil
}

func (c *Client) Listen() string {
return ""
}

func (c *Client) Backup() backup.Interface {
if c.FakeLocker != nil {
return c.FakeBackup()
Expand Down

0 comments on commit fcc618c

Please sign in to comment.