consumer/provider에 Authorization타입으로 고정

This commit is contained in:
2023-08-30 13:38:13 +09:00
parent a5d66a0249
commit d8458662fd
4 changed files with 43 additions and 37 deletions

View File

@ -9,7 +9,7 @@ import (
"repositories.action2quare.com/ayo/gocommon"
)
type Provider[T any] struct {
type Provider struct {
redisClient *redis.Client
updateChannel string
deleteChannel string
@ -17,13 +17,13 @@ type Provider[T any] struct {
ctx context.Context
}
func NewProvider[T any](ctx context.Context, redisUrl string, ttl time.Duration) (*Provider[T], error) {
func NewProvider(ctx context.Context, redisUrl string, ttl time.Duration) (*Provider, error) {
redisClient, err := gocommon.NewRedisClient(redisUrl)
if err != nil {
return nil, err
}
return &Provider[T]{
return &Provider{
redisClient: redisClient,
updateChannel: communication_channel_name_prefix + "_u",
deleteChannel: communication_channel_name_prefix + "_d",
@ -32,7 +32,7 @@ func NewProvider[T any](ctx context.Context, redisUrl string, ttl time.Duration)
}, nil
}
func (p *Provider[T]) Update(key string, input *T) error {
func (p *Provider) Update(key string, input *Authorization) error {
bt, err := bson.Marshal(input)
if err != nil {
return err
@ -47,7 +47,7 @@ func (p *Provider[T]) Update(key string, input *T) error {
return err
}
func (p *Provider[T]) Delete(key string) error {
func (p *Provider) Delete(key string) error {
cnt, err := p.redisClient.Del(p.ctx, key).Result()
if err != nil {
return err