postgresql-simple-0.6: Mid-Level PostgreSQL client library

Copyright(c) 2011-2012 Leon P Smith
(c) 2017 Bardur Arantsson
LicenseBSD3
MaintainerLeon P Smith <leon@melding-monads.com>
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Simple.Cursor

Contents

Description

 
Synopsis

Types

data Cursor Source #

Cursor within a transaction.

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.