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

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

 Source # Methodsdimap :: (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 # Methodsfmap :: (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. Instances  Source # Methodsfmap :: (a -> b) -> ReducingDecoder a -> ReducingDecoder b #(<$) :: a -> ReducingDecoder b -> ReducingDecoder a # Source # Methodspure :: a -> ReducingDecoder a #(<*>) :: ReducingDecoder (a -> b) -> ReducingDecoder a -> ReducingDecoder b #liftA2 :: (a -> b -> c) -> ReducingDecoder a -> ReducingDecoder b -> ReducingDecoder c #

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.

Batch size of 10.

Batch size of 100.

Batch size of 1000.

Batch size of 10000.