From 85ebb4749103f969f903e816ee3387c4693cfecd Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 1 Dec 2021 11:57:25 +0000 Subject: [PATCH] simplify id parsing --- db/handler/db.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db/handler/db.go b/db/handler/db.go index b5d7a14..c08759c 100644 --- a/db/handler/db.go +++ b/db/handler/db.go @@ -137,7 +137,7 @@ func (e *Db) Create(ctx context.Context, req *db.CreateRequest, rsp *db.CreateRe } // set the response id - rsp.Id = m[idKey].(string) + rsp.Id = id return nil } @@ -161,12 +161,9 @@ func (e *Db) Update(ctx context.Context, req *db.UpdateRequest, rsp *db.UpdateRe // where ID is specified do a single update record update id := req.Id - if v, ok := m[idKey].(string); ok && id == "" { - id = v - } // if the id is blank then check the data - if len(req.Id) == 0 { + if len(id) == 0 { var ok bool id, ok = m[idKey].(string) if !ok {