We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pageSize := 10 // 设置分页参数 pageNum := 3 // 第3页
cli.Find(ctx, bson.D{{"年龄", bson.M{"$gt": 0}}}).Page(pageNum , pageSize ).All(&users) //分页 cli.Find(ctx, bson.D{{"年龄", bson.M{"$gt": 0}}}).TotalPages(pageSize ) //取分页总数
你不觉得这使用频率好高么. 要不每个地方都得多写好几行.
The text was updated successfully, but these errors were encountered:
skip+limit可以实现呀,单独写个函数好像没有这个必要
Sorry, something went wrong.
跟我想到一块去了. 我就自己弄了一个函数
我已经想到了。 我就自己弄了一个函数
go中就这个用起来比较舒服
No branches or pull requests
pageSize := 10 // 设置分页参数
pageNum := 3 // 第3页
cli.Find(ctx, bson.D{{"年龄", bson.M{"$gt": 0}}}).Page(pageNum , pageSize ).All(&users) //分页
cli.Find(ctx, bson.D{{"年龄", bson.M{"$gt": 0}}}).TotalPages(pageSize ) //取分页总数
你不觉得这使用频率好高么. 要不每个地方都得多写好几行.
The text was updated successfully, but these errors were encountered: