diff --git a/internal/drivers/keyvaluedriver/keyvaluedriver.go b/internal/drivers/keyvaluedriver/keyvaluedriver.go index 3624612d8bb00a002c6d989e3a00da64fdab66f1..15c3595072b3b1b4229cea9d48b58890f1931d59 100644 --- a/internal/drivers/keyvaluedriver/keyvaluedriver.go +++ b/internal/drivers/keyvaluedriver/keyvaluedriver.go @@ -35,13 +35,12 @@ func (d *KeyValueDriver) Start() { } // Get retrieves the value from the redis store that belongs to the given key -func (d *KeyValueDriver) Get(key *string) *string { - value := d.client.Get(context.Background(), *key).Val() - return &value +func (d *KeyValueDriver) Get(key *string) string { + return d.client.Get(context.Background(), *key).Val() } // Set sets the key value pair in the redis store -func (d *KeyValueDriver) Set(key *string, value interface{}) error { - status := d.client.Set(context.Background(), *key, value, 0) +func (d *KeyValueDriver) Set(key *string, value *string) error { + status := d.client.Set(context.Background(), *key, *value, 0) return status.Err() } diff --git a/internal/drivers/keyvaluedriver/mock/mockkeyvaluedriver.go b/internal/drivers/keyvaluedriver/mock/mockkeyvaluedriver.go index 52f38c4703e803c71d62d5315516022fd789d4e3..981b7cdacb6d455d966913406dbe9569fed896df 100644 --- a/internal/drivers/keyvaluedriver/mock/mockkeyvaluedriver.go +++ b/internal/drivers/keyvaluedriver/mock/mockkeyvaluedriver.go @@ -2,23 +2,23 @@ package mockkeyvaluedriver // A KeyValueStore implements methods to set key-value data (mock) type KeyValueStore struct { - data map[string]interface{} + data map[string]string } // CreateKeyValueStore creates a key value store driver (mock) func CreateKeyValueStore() *KeyValueStore { return &KeyValueStore{ - data: make(map[string]interface{}), + data: make(map[string]string), } } // Set sets a key to a value in the key value store. Expects a non-pointer as value. (mock) -func (kvs *KeyValueStore) Set(key *string, value interface{}) error { - kvs.data[*key] = value +func (kvs *KeyValueStore) Set(key *string, value *string) error { + kvs.data[*key] = *value return nil } // Get gets the value for the supplied key from the key value store (mock) -func (kvs *KeyValueStore) Get(key *string) interface{} { +func (kvs *KeyValueStore) Get(key *string) string { return kvs.data[*key] }