mtg-price-bot/internal/scenario/test_cache.go
Artyom Belousov a33680d527 Redis -> YDB
2023-05-27 22:10:31 +03:00

29 lines
585 B
Go

package scenario
import (
"context"
"errors"
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
)
type testCache struct {
table map[string][]cardsinfo.ScgCardPrice
}
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")
}
return msg, nil
}
func (t *testCache) Set(ctx context.Context, cardName string, prices []cardsinfo.ScgCardPrice) error {
t.table[cardName] = prices
return nil
}