Skip to content

Conversation

brucx
Copy link

@brucx brucx commented Aug 11, 2017

No description provided.

@jysperm
Copy link
Contributor

jysperm commented Aug 11, 2017

skip 和 contains 其实都是我故意没有添加的,原因是它们都会导致查询的性能变得非常查,而对于大部分场景来说,它们又不是必须的,所以也不打算添加。

你添加 addAscending 和 addDescending 的目的是为了支持更多的排序字段么?如果是这样的话加一个 addAscending 也只是能增加 一个 额外的排序字段而已,我觉得可能更好的做法是把 ascending 改成一个 Union Type,同时支持 FieldEnum(单个排序条件)和 [FieldEnum](数组,多个排序条件)。

@brucx
Copy link
Author

brucx commented Aug 11, 2017

告知清楚利弊,选择留给用户?毕竟在表不大的情况下,用skip配合limit分页查询是很简单的,同时性能也能够接受。

使用ascending或者descending似乎不能实现先按属性a升序、再按b降序、再按c升序这样的需求,这样的需求在后台管理还是会遇到的。

@jysperm
Copy link
Contributor

jysperm commented Aug 11, 2017

skip 和 contains 我还是不打算加。

如果要这样排序的话,添加 addAscending 应该也不能解决,GraphQL 查询参数的各项之间应该是没有顺序之分的。可能要支持类似 CQL score,+name 这样的排序语法,不过这些写法似乎不是很好和强类型的 GraphQL 组合到一起。

https://leancloud.cn/docs/cql_guide.html#order_by

xyqfer added a commit to xyqfer/leancloud-graphql that referenced this pull request Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants