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/02/13 01:13:50 UTC

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #93: #92 replace limit/offset by pageNum/pageSize / add param:total

tianxiaoliang commented on a change in pull request #93: #92 replace limit/offset by pageNum/pageSize / add param:total
URL: https://github.com/apache/servicecomb-kie/pull/93#discussion_r378602538
 
 

 ##########
 File path: server/service/mongo/kv/kv_dao.go
 ##########
 @@ -117,11 +117,19 @@ func findKV(ctx context.Context, domain string, project string, opts service.Fin
 		}
 	}
 	opt := options.Find()
-	if opts.Limit != 0 {
-		opt = opt.SetLimit(opts.Limit)
+	if opts.PageSize != 0 && opts.PageNum != 0 {
+		opt = opt.SetLimit(opts.PageSize)
+		opt = opt.SetSkip(opts.PageSize * (opts.PageNum - 1))
 	}
-	if opts.Offset != 0 {
-		opt = opt.SetSkip(opts.Offset)
+	curTotal, errTotal := collection.CountDocuments(ctx, filter)
 
 Review comment:
   这个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