Redis -> YDB

This commit is contained in:
Artyom Belousov 2023-05-27 22:10:31 +03:00
parent 1f4888069f
commit a33680d527
21 changed files with 448 additions and 322 deletions

View file

@ -1,6 +1,7 @@
package scenario
import (
"context"
"errors"
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
@ -10,7 +11,11 @@ type testCache struct {
table map[string][]cardsinfo.ScgCardPrice
}
func (t *testCache) Get(cardName string) ([]cardsinfo.ScgCardPrice, error) {
func (t *testCache) Init(ctx context.Context) error {
return nil
}
func (t *testCache) Get(ctx context.Context, cardName string) ([]cardsinfo.ScgCardPrice, error) {
msg, ok := t.table[cardName]
if !ok {
return nil, errors.New("test")
@ -18,6 +23,7 @@ func (t *testCache) Get(cardName string) ([]cardsinfo.ScgCardPrice, error) {
return msg, nil
}
func (t *testCache) Set(cardName string, prices []cardsinfo.ScgCardPrice) {
func (t *testCache) Set(ctx context.Context, cardName string, prices []cardsinfo.ScgCardPrice) error {
t.table[cardName] = prices
return nil
}