Fix Close API call 05/105/1 v0.0.2
authorMarco Tallskog <marco.tallskog@nokia.com>
Fri, 3 May 2019 08:45:22 +0000 (11:45 +0300)
committerMarco Tallskog <marco.tallskog@nokia.com>
Fri, 3 May 2019 08:47:48 +0000 (11:47 +0300)
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 <marco.tallskog@nokia.com>
internal/sdlgoredis/sdlgoredis.go
sdl.go
sdl_test.go

index 01fe5f7..10b1bfe 100644 (file)
@@ -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 (file)
--- 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{} {
index 75ee321..dbd073f 100644 (file)
@@ -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)
 }