我想按范围从数据库中检索数据,即我想例如在第5个与第20个对象之间检索该怎么做:
我正在寻找一个看起来像这样的函数
let query = PFQuery(className: "Post")
query.order(byDescending: "createdAt")
query.range(range: 5..<20) //I want this, how to do??
query.limit = 5
答案 0 :(得分:1)
您可以结合使用limit
和skip
来实现此目的:
https://docs.parseplatform.org/ios/guide/#query-constraints
let query = PFQuery(className: "Post")
query.order(byDescending: "createdAt")
query.skip = 5
query.limit = 20 - 5 // 15 objects