From 9617339c09dfd2a0dca05afadb07ae3f7f06a9c6 Mon Sep 17 00:00:00 2001 From: Marco Tallskog Date: Fri, 3 May 2019 11:45:22 +0300 Subject: [PATCH] Fix Close API call Calling Close function from API caused a recursive call to itself as the underlying module was using a function with same name. Rename the internal close function to avoid this. Change-Id: I05c3ca8e79fb5f30cae81917f56efacbd1797768 Signed-off-by: Marco Tallskog --- internal/sdlgoredis/sdlgoredis.go | 2 +- sdl.go | 4 ++-- sdl_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/sdlgoredis/sdlgoredis.go b/internal/sdlgoredis/sdlgoredis.go index 01fe5f7..10b1bfe 100644 --- a/internal/sdlgoredis/sdlgoredis.go +++ b/internal/sdlgoredis/sdlgoredis.go @@ -67,7 +67,7 @@ func Create() *DB { return &db } -func (db *DB) Close() error { +func (db *DB) CloseDB() error { return db.client.Close() } diff --git a/sdl.go b/sdl.go index 04e0625..295d21e 100644 --- a/sdl.go +++ b/sdl.go @@ -27,7 +27,7 @@ import ( type iDatabase interface { MSet(pairs ...interface{}) error MGet(keys []string) ([]interface{}, error) - Close() error + CloseDB() error Del(keys []string) error Keys(key string) ([]string, error) SetIE(key string, oldData, newData interface{}) (bool, error) @@ -62,7 +62,7 @@ func NewSdlInstance(NameSpace string, db iDatabase) *SdlInstance { } func (s *SdlInstance) Close() error { - return s.Close() + return s.CloseDB() } func (s *SdlInstance) setNamespaceToKeys(pairs ...interface{}) []interface{} { diff --git a/sdl_test.go b/sdl_test.go index 75ee321..dbd073f 100644 --- a/sdl_test.go +++ b/sdl_test.go @@ -40,7 +40,7 @@ func (m *mockDB) MGet(keys []string) ([]interface{}, error) { return a.Get(0).([]interface{}), a.Error(1) } -func (m *mockDB) Close() error { +func (m *mockDB) CloseDB() error { a := m.Called() return a.Error(0) } -- 2.16.6