tianxiaoliang commented on a change in pull request #71: SCB-1723 support
pagination in kie apis
URL: https://github.com/apache/servicecomb-kie/pull/71#discussion_r367818020
##########
File path: server/service/mongo/history/dao.go
##########
@@ -27,11 +27,11 @@ import (
"go.mongodb.org/mongo-driver/mongo/options"
)
-func getHistoryByKeyID(ctx context.Context, filter bson.M) ([]*model.KVDoc,
error) {
+func getHistoryByKeyID(ctx context.Context, filter bson.M, limit, offset
int64) ([]*model.KVDoc, error) {
collection := session.GetDB().Collection(session.CollectionKVRevision)
cur, err := collection.Find(ctx, filter,
options.Find().SetSort(map[string]interface{}{
"revision": -1,
- }))
+ }).SetSkip(offset*limit).SetLimit(limit))
Review comment:
offset就是偏移量,是由前台算出来的,不需要再乘以限制数
----------------------------------------------------------------
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]
With regards,
Apache Git Services