unmarshal into interface

This commit is contained in:
Asim Aslam
2021-06-07 15:14:05 +01:00
parent 1cc4e2a340
commit 23be9b55cf

View File

@@ -16,7 +16,7 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse
return errors.BadRequest("cache.get", "missing key")
}
var value string
var value interface{}
if err := cache.Context(ctx).Get(req.Key, &value); err != nil {
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
// set the value
rsp.Value = value
rsp.Value = fmt.Sprintf("%v", value)
return nil
}