]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add docs for Cursor.scroll()
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 10 Feb 2021 01:18:51 +0000 (02:18 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 10 Feb 2021 01:18:51 +0000 (02:18 +0100)
docs/cursor.rst
psycopg3/psycopg3/cursor.py

index a1f0d9515db3e8e6037abd411443e05513f6bcef..1b7f7a012a53f4769d988ba333a01f747cf14302 100644 (file)
@@ -127,8 +127,10 @@ The `!Cursor` class
     .. automethod:: fetchmany
     .. automethod:: fetchall
     .. automethod:: nextset
+    .. automethod:: scroll
     .. autoattribute:: pgresult
 
+
     .. rubric:: Information about the data
 
     .. attribute:: description
@@ -192,6 +194,7 @@ The `!AsyncCursor` class
     .. automethod:: fetchone
     .. automethod:: fetchmany
     .. automethod:: fetchall
+    .. automethod:: scroll
 
     .. note:: You can also use ``async for record in cursor: ...`` to iterate
         on the async cursor results.
index 05cdc600115666fd042f294698ce0049a2ad21cc..b341f03a68954a40f617322157d6f08230595a3e 100644 (file)
@@ -570,6 +570,16 @@ class Cursor(BaseCursor["Connection"]):
             yield row
 
     def scroll(self, value: int, mode: str = "relative") -> None:
+        """
+        Move the cursor in the result set to a new position according to mode.
+
+        If *mode* is ``relative`` (default), value is taken as offset to the
+        current position in the result set, if set to ``absolute``, *value*
+        states an absolute target position.
+
+        Raise `!IndexError` in case a scroll operation would leave the result
+        set. In this case the position will not change.
+        """
         self._scroll(value, mode)
 
     @contextmanager