mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 06:25:07 +00:00
unmarshal into interface
This commit is contained in:
4
cache/handler/cache.go
vendored
4
cache/handler/cache.go
vendored
@@ -16,7 +16,7 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse
|
|||||||
return errors.BadRequest("cache.get", "missing key")
|
return errors.BadRequest("cache.get", "missing key")
|
||||||
}
|
}
|
||||||
|
|
||||||
var value string
|
var value interface{}
|
||||||
|
|
||||||
if err := cache.Context(ctx).Get(req.Key, &value); err != nil {
|
if err := cache.Context(ctx).Get(req.Key, &value); err != nil {
|
||||||
return errors.InternalServerError("cache.get", err.Error())
|
return errors.InternalServerError("cache.get", err.Error())
|
||||||
@@ -24,7 +24,7 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse
|
|||||||
|
|
||||||
rsp.Key = req.Key
|
rsp.Key = req.Key
|
||||||
// set the value
|
// set the value
|
||||||
rsp.Value = value
|
rsp.Value = fmt.Sprintf("%v", value)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user