You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/06/23 09:21:28 UTC

[GitHub] [servicecomb-kie] aseTo2016 commented on a change in pull request #185: [wip]add upload interface

aseTo2016 commented on a change in pull request #185:
URL: https://github.com/apache/servicecomb-kie/pull/185#discussion_r656916592



##########
File path: server/resource/v1/kv_resource.go
##########
@@ -40,51 +41,133 @@ import (
 type KVResource struct {
 }
 
+//Upload upload kvs
+func (r *KVResource) Upload(rctx *restful.Context) {
+	var err error
+	kvs := new([]*model.KVDoc)
+	if err = readRequest(rctx, kvs); err != nil {
+		WriteErrResponse(rctx, config.ErrInvalidParams, fmt.Sprintf(FmtReadRequestError, err))
+		return
+	}
+	result := &model.DocRespOfUpload{
+		Success: []*model.KVDoc{},
+		Failure: []*model.DocFailedOfUpload{},
+	}
+	logicOfOverride(kvs, rctx, result)
+	err = writeResponse(rctx, result)
+	if err != nil {
+		openlog.Error(err.Error())
+	}
+}
+
+func logicOfOverride(kvs *[]*model.KVDoc, rctx *restful.Context, result *model.DocRespOfUpload) {

Review comment:
       建议kvs使用slice,通过kvs[:]传入即可,result *model.DocRespOfUpload作为返回参数




-- 
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:
users@infra.apache.org