koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.5k stars 247 forks source link

Feature: 数据库操作如何进行分页和排序操作 #1039

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the problem related to the feature request

数据库操作如何进行分页和排序操作

Describe the solution you'd like

增加排序和分页的参数

Describe alternatives you've considered

No response

Additional context

No response

MaikoTan commented 1 year ago

Although this issue is closed, but I think it would be helpful to answer here before docs update:

ctx.database
  // Pagination:
  // or `.limit(limit)`
  // while `offset` and `limit` are both `number`
  .limit(offset, limit)
  // Sort:
  // `direction` could be 'asc' or 'desc'
  .orderBy(key, direction)

It is also possible to issue on https://github.com/koishijs/docs for the docs update.