hasql-cursor-query-0.4.3.1: A declarative abstraction over PostgreSQL Cursor

Safe HaskellNone
LanguageHaskell2010

Hasql.CursorQuery

Description

A DSL for declaring queries.

Synopsis

Documentation

data CursorQuery params result Source #

A specification of a streaming query.

Provides an abstraction over Postgres Cursor, which allows to process result sets of any size in constant memory.

Essentially it is a parametric query specification extended with a reduction strategy and a batch size, where reduction strategy determines how to fold the rows into the final result, and batch size determines how many rows to fetch during each roundtrip to the database.

Instances

Profunctor CursorQuery Source # 

Methods

dimap :: (a -> b) -> (c -> d) -> CursorQuery b c -> CursorQuery a d #

lmap :: (a -> b) -> CursorQuery b c -> CursorQuery a c #

rmap :: (b -> c) -> CursorQuery a b -> CursorQuery a c #

(#.) :: Coercible * c b => (b -> c) -> CursorQuery a b -> CursorQuery a c #

(.#) :: Coercible * b a => CursorQuery b c -> (a -> b) -> CursorQuery a c #

Functor (CursorQuery params) Source # 

Methods

fmap :: (a -> b) -> CursorQuery params a -> CursorQuery params b #

(<$) :: a -> CursorQuery params b -> CursorQuery params a #

cursorQuery :: ByteString -> Params params -> ReducingDecoder result -> BatchSize -> CursorQuery params result Source #

Given an SQL template, a params encoder, a reducing result decoder and a batch-size, constructs CursorQuery.

data ReducingDecoder reduction Source #

A specification of how to decode and reduce multiple rows.

Composable with the Applicative interface.

reducingDecoder :: Row row -> Fold row reduction -> ReducingDecoder reduction Source #

Packs a row decoder and a fold over rows into ReducingDecoder.

data BatchSize :: * #

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

batchSize_10 :: BatchSize #

Batch size of 10.

batchSize_100 :: BatchSize #

Batch size of 100.

batchSize_1000 :: BatchSize #

Batch size of 1000.

batchSize_10000 :: BatchSize #

Batch size of 10000.