Skip to content
Snippets Groups Projects

Add an item cursor to the connection edge

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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"
  • Merge request was accepted

  • vlorentz approved this merge request

    approved this merge request

  • vlorentz
    vlorentz @vlorentz started a thread on the diff
  • 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)
  • Author Contributor

    Extra test for item cursor

  • 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.

  • Author Contributor

    Merge request was merged

  • closed

  • Please register or sign in to reply
    Loading