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/04/22 13:15:32 UTC

[GitHub] [servicecomb-kie] little-cui opened a new pull request #181: List operation support wildcard match method

little-cui opened a new pull request #181:
URL: https://github.com/apache/servicecomb-kie/pull/181


   


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



[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #181: List operation support wildcard match method

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #181:
URL: https://github.com/apache/servicecomb-kie/pull/181#discussion_r618390796



##########
File path: server/service/mongo/kv/kv_dao.go
##########
@@ -123,8 +123,14 @@ func findKV(ctx context.Context, domain string, project string, opts service.Fin
 	filter := bson.M{"domain": domain, "project": project}
 	if opts.Key != "" {
 		filter["key"] = opts.Key
-		if strings.HasPrefix(opts.Key, "beginWith") {
-			filter["key"] = bson.M{"$regex": getValue(opts.Key), "$options": "$i"}
+		switch {
+		case strings.HasPrefix(opts.Key, "beginWith("):
+			value := strings.ReplaceAll(getValue(opts.Key), ".", "\\.")
+			filter["key"] = bson.M{"$regex": value, "$options": "$i"}
+		case strings.HasPrefix(opts.Key, "match("):

Review comment:
       match改为wildcard是否更加合理




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



[GitHub] [servicecomb-kie] tianxiaoliang merged pull request #181: List operation support wildcard match method

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #181:
URL: https://github.com/apache/servicecomb-kie/pull/181


   


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