module Hasql.Conduit (
conduitQuery,
) where
import Control.Monad.Trans.Class
import Data.Conduit
import Data.Conduit.List
import Hasql.Statement
import Hasql.CursorTransactionIO
import Hasql.Streams
conduitQuery :: Statement params [a] -> params ->
ConduitT () a (CursorTransactionIO s) ()
conduitQuery :: Statement params [a]
-> params -> ConduitT () a (CursorTransactionIO s) ()
conduitQuery Statement params [a]
stmt params
params = Statement params [a]
-> params
-> CursorStreamFold s a (ConduitT () a (CursorTransactionIO s) ())
-> ConduitT () a (CursorTransactionIO s) ()
forall params s a r.
Statement params [a] -> params -> CursorStreamFold s a r -> r
cursorStreamQuery Statement params [a]
stmt params
params CursorStreamFold s a (ConduitT () a (CursorTransactionIO s) ())
forall s a.
CursorStreamFold s a (ConduitT () a (CursorTransactionIO s) ())
foldConduitStream
foldConduitStream :: CursorStreamFold s a (ConduitT () a (CursorTransactionIO s) ())
foldConduitStream :: (x -> CursorTransactionIO s (Maybe (a, x)))
-> CursorTransactionIO s x
-> ConduitT () a (CursorTransactionIO s) ()
foldConduitStream x -> CursorTransactionIO s (Maybe (a, x))
step CursorTransactionIO s x
init = CursorTransactionIO s x -> ConduitT () a (CursorTransactionIO s) x
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift CursorTransactionIO s x
init ConduitT () a (CursorTransactionIO s) x
-> (x -> ConduitT () a (CursorTransactionIO s) ())
-> ConduitT () a (CursorTransactionIO s) ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (x -> CursorTransactionIO s (Maybe (a, x)))
-> x -> ConduitT () a (CursorTransactionIO s) ()
forall (m :: * -> *) b a i.
Monad m =>
(b -> m (Maybe (a, b))) -> b -> ConduitT i a m ()
unfoldM x -> CursorTransactionIO s (Maybe (a, x))
step