Add an item cursor to the connection edge
2 unresolved threads
Closed
requested to merge generated-differential-D7957-source into generated-differential-D7957-target
2 unresolved threads
This will add the possibility to get items in a connection from any arbitrary position. Generic implementation is using item index along with the offset (after argument) to generate a cursor
Fixes #4291 (closed)
Migrated from D7957 (view on Phabricator)
Merge request reports
Activity
Build is green
Patch application report for D7957 (id=28651)
Rebasing onto e22537ef...
Current branch diff-target is up to date.
Changes applied before test
commit 54120da78afed7bf5941256f0ea3a6e3b092b801 Author: Jayesh Velayudhan <jayesh@softwareheritage.org> Date: Fri Jun 3 11:03:50 2022 +0200 Add an item cursor to the connection edge This will add the possibility to get items in a connection from any arbitrary position. Generic implementation is using item index along with the offset (after argument) to generate a cursor Fixes #4291
See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/43/ for more details.
110 120 page_size is set to 50 by default 111 121 """ 112 122 return self.kwargs.get("first", self._page_size) 123 124 def _get_index_cursor(self, index: int, node: Any): 125 """ 126 Get the cursor to the given item index 127 """ 128 # default implementation which works with swh-storage pagaination 129 # override this function to support other types (eg: SnapshotBranchConnection) 130 offset_index = self._get_after_arg() or "0" 83 query_str = f""" 84 {{ 85 origins(first: 1, after: "{end_cursor}") {{ 86 edges {{ 87 cursor 88 node {{ 89 id 90 }} 91 }} 92 nodes {{ 93 id 94 }} 95 }} 96 }} 97 """ 98 data, _ = get_query_response(client, query_str) @vlorentz It actually works. I was comparing the wrong objects. Thanks I thought it was an issue with an arbitrary offset used in in-memory DB.
Some references in the commit message have been migrated:
- T4291 is now #4291 (closed)
Build is green
Patch application report for D7957 (id=28656)
Rebasing onto e22537ef...
Current branch diff-target is up to date.
Changes applied before test
commit b7395eff481bfb3e69c67d22b6fa9faaa1a46af4 Author: Jayesh Velayudhan <jayesh@softwareheritage.org> Date: Fri Jun 3 11:03:50 2022 +0200 Add an item cursor to the connection edge This will add the possibility to get items in a connection from any arbitrary position. Generic implementation is using item index along with the offset (after argument) to generate a cursor Fixes #4291
See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/44/ for more details.
Please register or sign in to reply