Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 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 |