From 23be9b55cfda8e134fc7fa36d83be4192270ddf2 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 7 Jun 2021 15:14:05 +0100 Subject: [PATCH] unmarshal into interface --- cache/handler/cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/handler/cache.go b/cache/handler/cache.go index b27fc69..0049448 100644 --- a/cache/handler/cache.go +++ b/cache/handler/cache.go @@ -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 }