kliento.*RedisRepository.SetName   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package kliento
2
3
import (
4
	"context"
5
6
	"github.com/redis/go-redis/v9"
7
)
8
9
type RedisRepository struct {
10
	RedisConn *redis.Client
11
}
12
13
func NewRedisRepository(redisConn *redis.Client) IRedisRepository {
14
	return &RedisRepository{RedisConn: redisConn}
15
}
16
17
// GetName returns the name of the repository.
18
func (r *RedisRepository) GetName() string {
19
	return r.RedisConn.Get(context.Background(), "name").Val()
20
}
21
22
// SetName sets the name of the repository.
23
func (r *RedisRepository) SetName(name string) error {
24
	return r.RedisConn.Set(context.Background(), "name", name, 0).Err()
25
}
26