Implement "listTx"

This commit is contained in:
Nikita Volkov 2014-12-28 03:45:08 +03:00
parent 40326f33e0
commit 0015dd5501
2 changed files with 8 additions and 1 deletions

View File

@ -7,7 +7,6 @@
* The transaction mode is now extended to support uncommittable transactions with the `TxWriteMode` type.
* All `Tx` functions are now appended with a "Tx" suffix.
* `q` statement quasi-quoter is now renamed to more meaningful `stmt`.
* There is no `list` transaction any more. Instead there is `vectorTx`.
* The `Statement` type is renamed to `Stmt` and is now exported from the main API.
* `RowParser` is now uninstantiable. This enforces the idiomatic usage of the library.
* Statement templates now support UTF-8.

View File

@ -34,6 +34,7 @@ module Hasql
unitTx,
countTx,
maybeTx,
listTx,
vectorTx,
streamTx,
@ -264,6 +265,13 @@ maybeTx :: RowParser.RowParser c r => Bknd.Stmt c -> Tx c s (Maybe r)
maybeTx =
fmap (fmap Vector.unsafeHead . mfilter (not . Vector.null) . Just) . vectorTx
-- |
-- Execute a @SELECT@ statement,
-- and produce a list of results.
listTx :: RowParser.RowParser c r => Bknd.Stmt c -> Tx c s [r]
listTx =
fmap toList . vectorTx
-- |
-- Execute a @SELECT@ statement,
-- and produce a vector of results.