hdbi-conduit-1.3.0: Conduit glue for HDBI

Safe HaskellNone




Conduit functions

selectAll :: (Connection con, MonadResource m, FromRow row, ToRow params) => con -> Query -> params -> Source m rowSource

Execute query and stream result

insertAll :: (Connection con, MonadResource m, ToRow a) => con -> Query -> Sink a m ()Source

perform executeRow for each input row

insertAllCount :: (Connection con, MonadResource m, Num count, ToRow a) => con -> Query -> Sink a m countSource

same as insertAll but also count executed rows

insertAllTrans :: (Connection con, MonadResource m, ToRow a) => con -> Query -> Sink (Flush a) m ()Source

Execute query on each (Chunk row) and commit on each Flush. The last query is always commit, so be carefull.

flushAt :: (Monad m, Integral i) => i -> Conduit a m (Flush a)Source

separate each i chunks with Flush

flushBy :: Monad m => (a -> a -> Bool) -> Conduit a m (Flush a)Source

The behaviour is the same as groupBy function. Each time when prefix return False the conduit yields Flush.

Auxiliary conduit functions

statementSource :: (Statement stmt, MonadResource m) => (stmt -> m (Maybe a)) -> IO stmt -> Source m aSource

Get all values from the statement until action return ''Just a''

statementSink :: (Statement stmt, MonadResource m) => (stmt -> a -> m ()) -> IO stmt -> Sink a m ()Source

Same as statementSinkCount but without counting, just return ()

statementSinkCount :: (Statement stmt, MonadResource m, Num count) => (stmt -> a -> m ()) -> IO stmt -> Sink a m countSource

Execute action many times with given thread of values, return the count of executions

statementSinkTrans :: (Connection con, ConnStatement con ~ stmt, MonadResource m, MonadIO m) => con -> (stmt -> a -> m ()) -> IO stmt -> Sink (Flush a) m ()Source

Execute each chunk with putter function and commit transaction on each flush. The last action is always commit.

ResourceT functions

allocStmt :: (Statement stmt, MonadResource m) => IO stmt -> m (ReleaseKey, stmt)Source

executeStmt :: (Connection con, ConnStatement con ~ stmt, ToRow row, MonadResource m) => con -> Query -> row -> m (ReleaseKey, stmt)Source

Stream typing helpers

asSqlVals :: Monad m => Conduit [SqlValue] m [SqlValue]Source

Function to fuse when no data convertion is needed

asThisType :: Monad m => a -> Conduit a m aSource

To specify actual stream type by fusing with it. The value of argument is not used