Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hasql.CursorQuery
Description
A DSL for declaring queries.
- data CursorQuery params result
- cursorQuery :: ByteString -> Params params -> ReducingDecoder result -> BatchSize -> CursorQuery params result
- data ReducingDecoder reduction
- reducingDecoder :: Row row -> Fold row reduction -> ReducingDecoder reduction
- data BatchSize :: *
- batchSize_10 :: BatchSize
- batchSize_100 :: BatchSize
- batchSize_1000 :: BatchSize
- batchSize_10000 :: BatchSize
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 # | |
Functor (CursorQuery params) Source # | |
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
reducingDecoder :: Row row -> Fold row reduction -> ReducingDecoder reduction Source #
Packs a row decoder and a fold over rows into ReducingDecoder.
Batch size of 10.
Batch size of 100.
Batch size of 1000.
batchSize_10000 :: BatchSize #
Batch size of 10000.