hasql-0.20.0.1: An efficient native PostgreSQL driver

Safe HaskellNone
LanguageHaskell2010

Hasql.DecodeResult

Synopsis

Documentation

data DecodeResult result Source #

Instances

Functor DecodeResult Source # 

Methods

fmap :: (a -> b) -> DecodeResult a -> DecodeResult b #

(<$) :: a -> DecodeResult b -> DecodeResult a #

ignore :: DecodeResult () Source #

Ignore the result.

length :: DecodeResult Int Source #

The amount of rows affected by the statement. All statements produce this result.

head :: DecodeRow row -> DecodeResult row Source #

First row of a non-empty result. Raises a connection error if there's no rows.

headIfExists :: DecodeRow row -> DecodeResult (Maybe row) Source #

First row of a possibly empty result set.

vector :: DecodeRow row -> DecodeResult (Vector row) Source #

Vector of rows.

list :: DecodeRow row -> DecodeResult [row] Source #

List of rows. Slower than revList.

revList :: DecodeRow row -> DecodeResult [row] Source #

List of rows in a reverse order. Faster than list.

hashMap :: (Eq key, Hashable key) => DecodeRow (key, value) -> DecodeResult (HashMap key value) Source #

Rows folded into a map.

foldRows :: Fold row result -> DecodeRow row -> DecodeResult (result, Int) Source #

Essentially, a specification of Map/Reduce over all the rows of the result set. Can be used to produce all kinds of containers or to implement aggregation algorithms on the client side.

Besides the result of folding it returns the amount of affected rows, since it's provided by the database either way.

foldMRows :: FoldM IO row result -> DecodeRow row -> DecodeResult (result, Int) Source #

Essentially, a specification of Map/Reduce over all the rows of the result set. Can be used to produce all kinds of containers or to implement aggregation algorithms on the client side.

Besides the result of folding it returns the amount of affected rows, since it's provided by the database either way.