tianxiaoliang commented on a change in pull request #162:
URL: https://github.com/apache/servicecomb-kie/pull/162#discussion_r508231099
##########
File path: server/service/mongo/kv/kv_dao.go
##########
@@ -108,12 +110,23 @@ func updateKeyValue(ctx context.Context, kv *model.KVDoc)
error {
}
+//Extract key values
+func getValue(str string) string {
+ rex :=regexp.MustCompile(`\(([^)]+)\)`)
+ res :=rex.FindStringSubmatch(str)
+ return res[len(res)-1]
+}
+
func findKV(ctx context.Context, domain string, project string, opts
service.FindOptions) (*mongo.Cursor, int, error) {
collection := session.GetDB().Collection(session.CollectionKV)
ctx, _ = context.WithTimeout(ctx, opts.Timeout)
filter := bson.M{"domain": domain, "project": project}
if opts.Key != "" {
- filter["key"] = opts.Key
+ if strings.HasPrefix(opts.Key, "beginWith"){
Review comment:
consider about the open-close principle
https://blog.csdn.net/u011250882/article/details/47358519
there are many article about OCP, please take a look at them
----------------------------------------------------------------
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]