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 2020/03/25 10:07:57 UTC

[GitHub] [servicecomb-kie] tianxiaoliang opened a new pull request #127: able to get key by id

tianxiaoliang opened a new pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #127: able to get key by id

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127#discussion_r398339124
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -122,11 +122,25 @@ func (r *KVResource) List(rctx *restful.Context) {
 	var err error
 	project := rctx.ReadPathParameter(PathParameterProject)
 	domain := ReadDomain(rctx)
+	kvID := rctx.ReadQueryParameter(common.QueryParamKeyID)
 
 Review comment:
   URLPatterns和API文档添上这个parameters

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #127: able to get key by id

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127#discussion_r398341256
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -122,11 +122,25 @@ func (r *KVResource) List(rctx *restful.Context) {
 	var err error
 	project := rctx.ReadPathParameter(PathParameterProject)
 	domain := ReadDomain(rctx)
+	kvID := rctx.ReadQueryParameter(common.QueryParamKeyID)
+	if kvID != "" {
+		kv, err := service.KVService.Get(rctx.Ctx, domain.(string), project, kvID)
+		if err != nil {
+			WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
 
 Review comment:
   不一定是BadRequest,可能是数据库内部错误、decode err和没找到

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang closed pull request #127: able to get key by id

Posted by GitBox <gi...@apache.org>.
tianxiaoliang closed pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #127: able to get key by id

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127#discussion_r398341256
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -122,11 +122,25 @@ func (r *KVResource) List(rctx *restful.Context) {
 	var err error
 	project := rctx.ReadPathParameter(PathParameterProject)
 	domain := ReadDomain(rctx)
+	kvID := rctx.ReadQueryParameter(common.QueryParamKeyID)
+	if kvID != "" {
+		kv, err := service.KVService.Get(rctx.Ctx, domain.(string), project, kvID)
+		if err != nil {
+			WriteErrResponse(rctx, http.StatusBadRequest, err.Error(), common.ContentTypeText)
 
 Review comment:
   不一定是BadRequest,可能是数据库内部错误、和没找到

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #127: able to get key by id

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #127: able to get key by id
URL: https://github.com/apache/servicecomb-kie/pull/127#discussion_r398298103
 
 

 ##########
 File path: server/service/mongo/kv/kv_service.go
 ##########
 @@ -210,36 +208,8 @@ func (s *Service) FindKV(ctx context.Context, domain string, project string, opt
 	if project == "" {
 		return nil, session.ErrMissingProject
 	}
-
-	if opts.ID != "" {
-		openlogging.Debug(MsgFindOneKeyByID, openlogging.WithTags(openlogging.Tags{
-			"id":     opts.ID,
-			"key":    opts.Key,
-			"labels": opts.Labels,
-		}))
-		return findKVByID(ctx, domain, project, opts.ID)
+	if id == "" {
+		return nil, session.ErrIDIsNil
 	}
-
-	cur, _, err := findKV(ctx, domain, project, opts)
-	if err != nil {
-		return nil, err
-	}
-	defer cur.Close(ctx)
-
-	if opts.Depth == 0 && opts.Key != "" {
-		openlogging.Debug(MsgFindOneKey, openlogging.WithTags(
-			map[string]interface{}{
-				"key":    opts.Key,
-				"label":  opts.Labels,
-				"domain": domain,
-			},
-		))
-		return cursorToOneKV(ctx, cur, opts.Labels)
 
 Review comment:
   cursorToOneKV函数应该没有别处调用了吧,没的话就删了吧

----------------------------------------------------------------
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


With regards,
Apache Git Services