hasql-cursor-transaction-0.5.0.1: An abstraction for simultaneous fetching from multiple PostgreSQL cursors

Safe HaskellNone
LanguageHaskell2010

Hasql.CursorTransaction

Contents

Synopsis

Types

data CursorTransaction s result Source

Context for fetching from multiple cursors in an intertwined fashion.

data Cursor s Source

Cursor reference.

data BatchSize Source

Spefifies how many rows to fetch in a single DB roundtrip.

data EncodedParams Source

A parameters encoder immediately supplied with parameters.

Cursor Transactions

withCursor :: ByteString -> EncodedParams -> (forall s. Cursor s -> CursorTransaction s result) -> CursorTransaction s result Source

Given a template, encoded params and a Cursor-handling continuation, executes it, while automatically declaring and closing the cursor behind the scenes.

fetchBatch :: Cursor s -> BatchSize -> Result result -> CursorTransaction s result Source

Fetch from a cursor a batch of the given size and decode it using the specified result decoder.

transaction :: Transaction result -> CursorTransaction s result Source

Lift a standard transaction. Note that the transaction must not execute other CursorTransactions.

Batch Sizes

batchSize_10 :: BatchSize Source

Batch size of 10.

batchSize_100 :: BatchSize Source

Batch size of 100.

batchSize_1000 :: BatchSize Source

Batch size of 1000.

batchSize_10000 :: BatchSize Source

Batch size of 10000.

Encoded Params

encodedParams :: Params params -> params -> EncodedParams Source

Pack the params encoder and params into EncodedParams.