English 中文(简体)
• 如何用巧克力执行与“热线”连接的冲淡的想象力?
原标题:How to implement offset pagination with Connection in Hot Chocolate?

As doc says Note: Connections are often associated with cursor-based pagination, due to the use of a cursor. Nonetheless, since the specification describes the cursor as opaque, it can be used to facilitate an offset as well.

<代码>说明: 虽然我们支持以抵消为基础的想象力,但我们大力鼓励使用连接。 链接提供了一个摘要,便于在后面转用另一个想象机制。

但没有提供实例。

Any idea how to implement offset pagination with Connection in Hot Chocolate? Its not clear for me.

问题回答

此处的信息基于“热电离层”第13/>条。

I did find that the HotChocolate v12 documentation has some additional information on Pagination that helps. Best to read both.
https://chillicream.com/docs/hotchocolate/v12/fetching-data/pagination https://chillicream.com/docs/hotchocolate/v13/fetching-data/pagination

利用电离层的[UsePaging]属性,自动增加了该表的链接。 在以下例子中,我有一个称为AreaType>。 <>AreaTypesConnection在使用[UsePaging]时自动生成。 你们需要在客户方面开展一些行动,以充实下文所强调的参数。 这些参数混淆了 cur。

enter image description here

与此相关,nodes载有你收复的问询(例如,Types地区)所交回的物品。 Count 查询的物品数目。

“entergraph

在<网页上,有额外价值,热电离层人口,帮助将 cur子压在客户方。

“entergraph

If you were strictly looking for configuring cursor pagination on the client-side, I would not search for HotChocolate examples specifically. I would google the client-side technology you are using (e.g. "cursor pagination in angular"). Combined with the above information should help.

Of course, you can opt to not use connections. You can use the [UseOffsetPaging] attribute instead of the [UsePaging] attribute. When using the [UseOffsetPaging] attribute, a collection segment is created instead of a connection. There is a little more ease in this option. You only need to configure skip and take parameters.

enter image description here

When viewing the collection segment, instead of nodes, the collection of items is simply called items. You can still retrieve your totalCount which can be used to determine your skip and take parameter values. Under pageInfo, is additional properties populated by HotChocolate that you may also need to determine your skip and take parameter values.

“entergraph





相关问题
热门标签