tianxiaoliang commented on a change in pull request #126: modify the return
body format of kv and history
URL: https://github.com/apache/servicecomb-kie/pull/126#discussion_r398381581
##########
File path: server/service/mongo/kv/kv_service.go
##########
@@ -92,24 +92,35 @@ func (s *Service) CreateOrUpdate(ctx context.Context, kv
*model.KVDoc) (*model.K
openlogging.Error(err.Error())
return nil, err
}
- kv.Domain = ""
- kv.Project = ""
- return kv, nil
+ return convertKVToResponse(kv), nil
}
kv.ID = oldKV.ID
kv.CreateRevision = oldKV.CreateRevision
err = updateKeyValue(ctx, kv)
if err != nil {
return nil, err
}
- kv.Domain = ""
- kv.Project = ""
- return kv, nil
+ return convertKVToResponse(kv), nil
}
+func convertKVToResponse(kvDoc *model.KVDoc) *model.DocResponseSingleKey {
Review comment:
这个成本太高,GET one的逻辑虽然没问题,但真的不合适,直接用最终模型反序列化就行了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services