Copyright | (c) 2011-2012 Leon P Smith (c) 2017 Bardur Arantsson |
---|---|
License | BSD3 |
Maintainer | Leon P Smith <leon@melding-monads.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Database.PostgreSQL.Simple.Cursor
Description
Synopsis
- data Cursor
- declareCursor :: Connection -> Query -> IO Cursor
- closeCursor :: Cursor -> IO ()
- foldForward :: FromRow r => Cursor -> Int -> (a -> r -> IO a) -> a -> IO (Either a a)
- foldForwardWithParser :: Cursor -> RowParser r -> Int -> (a -> r -> IO a) -> a -> IO (Either a a)
Types
Cursor management
declareCursor :: Connection -> Query -> IO Cursor Source #
Declare a temporary cursor. The cursor is given a unique name for the given connection.
closeCursor :: Cursor -> IO () Source #
Close the given cursor.
Folding over rows from a cursor
foldForward :: FromRow r => Cursor -> Int -> (a -> r -> IO a) -> a -> IO (Either a a) Source #
Fold over a chunk of rows, calling the supplied fold-like function
on each row as it is received. In case the cursor is exhausted,
a Left
value is returned, otherwise a Right
value is returned.
foldForwardWithParser :: Cursor -> RowParser r -> Int -> (a -> r -> IO a) -> a -> IO (Either a a) Source #
Fold over a chunk of rows from the given cursor, calling the
supplied fold-like function on each row as it is received. In case
the cursor is exhausted, a Left
value is returned, otherwise a
Right
value is returned.