From db770c3fe77c4cca6cddcbb073cd5b79d20b14e7 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 12 Dec 2023 13:48:47 +0300 Subject: [PATCH] add ability to get *redis.Client Signed-off-by: Vasiliy Tolstov --- redis.go | 4 ++++ redis_test.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/redis.go b/redis.go index bb7c8ad..dc27701 100755 --- a/redis.go +++ b/redis.go @@ -42,6 +42,10 @@ func (r *Store) Init(opts ...store.Option) error { return r.configure() } +func (r *Store) Redis() *redis.Client { + return r.cli.(*redis.Client) +} + func (r *Store) Disconnect(ctx context.Context) error { return r.cli.Close() } diff --git a/redis_test.go b/redis_test.go index 9933506..13fbd6c 100755 --- a/redis_test.go +++ b/redis_test.go @@ -71,11 +71,11 @@ func Test_rkv_configure(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - r := &rkv{ + rc := &Store{ opts: tt.fields.options, cli: tt.fields.Client, } - err := r.configure() + err := rc.configure() if (err != nil) != tt.wantErr { t.Errorf("configure() error = %v, wantErr %v", err, tt.wantErr) return