MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / forward

Method forward

asyncpg/cursor.py:304–323  ·  view source on GitHub ↗

r"""Skip over the next *n* rows. :param float timeout: Optional timeout value in seconds. :return: A number of rows actually skipped over (<= *n*).

(self, n, *, timeout=None)

Source from the content-addressed store, hash-verified

302
303 @connresource.guarded
304 async def forward(self, n, *, timeout=None) -> int:
305 r"""Skip over the next *n* rows.
306
307 :param float timeout: Optional timeout value in seconds.
308
309 :return: A number of rows actually skipped over (<= *n*).
310 """
311 self._check_ready()
312 if n <= 0:
313 raise exceptions.InterfaceError('n must be greater than zero')
314
315 protocol = self._connection._protocol
316 status = await protocol.query('MOVE FORWARD {:d} {}'.format(
317 n, self._portal_name), timeout)
318
319 advanced = int(status.split()[1])
320 if advanced < n:
321 self._exhausted = True
322
323 return advanced

Callers 4

test_pool_11Method · 0.80
test_timeout_06Method · 0.80
test_cursor_02Method · 0.80
test_cursor_04Method · 0.80

Calls 1

_check_readyMethod · 0.80

Tested by 4

test_pool_11Method · 0.64
test_timeout_06Method · 0.64
test_cursor_02Method · 0.64
test_cursor_04Method · 0.64