안쓰는 코드 정리 및 bson을 json으로 통일. 추후 gob으로 변경 예정
This commit is contained in:
@ -2,11 +2,11 @@ package session
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
@ -43,7 +43,7 @@ func newProviderWithRedis(ctx context.Context, redisUrl string, ttl time.Duratio
|
||||
}
|
||||
|
||||
func (p *provider_redis) New(input *Authorization) (string, error) {
|
||||
bt, err := bson.Marshal(input)
|
||||
bt, err := json.Marshal(input)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -82,7 +82,7 @@ func (p *provider_redis) Query(pk string) (Authorization, error) {
|
||||
}
|
||||
|
||||
var auth Authorization
|
||||
if err := bson.Unmarshal([]byte(payload), &auth); err != nil {
|
||||
if err := json.Unmarshal([]byte(payload), &auth); err != nil {
|
||||
return Authorization{}, err
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ func (c *consumer_redis) query_internal(sk storagekey) (*sessionRedis, bool, err
|
||||
}
|
||||
|
||||
var auth Authorization
|
||||
if err := bson.Unmarshal([]byte(payload), &auth); err != nil {
|
||||
if err := json.Unmarshal([]byte(payload), &auth); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user