From b263b690313d5b9b1d3d458ec9abb91f153ad5c7 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 2249282..f5dc9ba 100755 --- a/redis.go +++ b/redis.go @@ -43,6 +43,10 @@ func (r *Store) Init(opts ...options.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 ba2f688..e961808 100755 --- a/redis_test.go +++ b/redis_test.go @@ -72,11 +72,11 @@ func Test_rkv_configure(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - r := &Store{ + 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 -- 2.45.2