From cf46b13e78711032353fb5607a0168e3816a5a51 Mon Sep 17 00:00:00 2001 From: Pantelis Sampaziotis Date: Tue, 30 Aug 2022 15:53:51 +0200 Subject: [PATCH] format code --- test_redis_client.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test_redis_client.go b/test_redis_client.go index a10fd7b..c076f16 100644 --- a/test_redis_client.go +++ b/test_redis_client.go @@ -7,7 +7,7 @@ import ( "time" ) -//TestRedisClient is a mock for redis +// TestRedisClient is a mock for redis type TestRedisClient struct { store sync.Map ttl sync.Map @@ -15,7 +15,7 @@ type TestRedisClient struct { var lock sync.Mutex -//NewTestRedisClient returns a NewTestRedisClient +// NewTestRedisClient returns a NewTestRedisClient func NewTestRedisClient() *TestRedisClient { return &TestRedisClient{} } @@ -57,7 +57,7 @@ func (client *TestRedisClient) Get(key string) (string, error) { return "nil", nil } -//Del removes the specified key. A key is ignored if it does not exist. +// Del removes the specified key. A key is ignored if it does not exist. func (client *TestRedisClient) Del(key string) (affected int64, err error) { _, found := client.store.Load(key) @@ -129,9 +129,9 @@ func (client *TestRedisClient) LPush(key string, value ...string) (total int64, return int64(len(list)) + 1, nil } -//LLen returns the length of the list stored at key. -//If key does not exist, it is interpreted as an empty list and 0 is returned. -//An error is returned when the value stored at key is not a list. +// LLen returns the length of the list stored at key. +// If key does not exist, it is interpreted as an empty list and 0 is returned. +// An error is returned when the value stored at key is not a list. func (client *TestRedisClient) LLen(key string) (affected int64, err error) { list, err := client.findList(key) @@ -347,12 +347,12 @@ func (client *TestRedisClient) FlushDb() error { return nil } -//storeSet stores a set +// storeSet stores a set func (client *TestRedisClient) storeSet(key string, set map[string]struct{}) { client.store.Store(key, set) } -//findSet finds a set +// findSet finds a set func (client *TestRedisClient) findSet(key string) (map[string]struct{}, error) { //Lookup the store for the list storedValue, found := client.store.Load(key) @@ -371,14 +371,14 @@ func (client *TestRedisClient) findSet(key string) (map[string]struct{}, error) return make(map[string]struct{}), nil } -//storeList is an helper function so others don't have to deal with pointers +// storeList is an helper function so others don't have to deal with pointers func (client *TestRedisClient) storeList(key string, list []string) { client.store.Store(key, &list) } -//findList returns the list stored at key. -//if key doesn't exist, an empty list is returned -//an error is returned when the value at key isn't a list +// findList returns the list stored at key. +// if key doesn't exist, an empty list is returned +// an error is returned when the value at key isn't a list func (client *TestRedisClient) findList(key string) ([]string, error) { //Lookup the store for the list storedValue, found := client.store.Load(key)