Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions for streaming DB queries.
Synopsis
- type NumberOfRows = Int
- bulkSelectAllRows :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity)) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> Connection -> m [a Identity]
- bulkSelectAllRowsWhere :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity)) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> (forall s. PostgresFilterLambda a s) -> Connection -> m [a Identity]
- streamingSelectAllPipeline :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity), GenericVinyl (a Identity) a_names a_rs) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> ConduitT (Record (ZipTypes a_names a_rs)) out m () -> Connection -> m [out]
- streamingSelectAllPipeline' :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity), GenericVinyl (a Identity) a_names a_rs) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> (forall s. PostgresFilterLambda a s) -> ConduitT (Record (ZipTypes a_names a_rs)) out m () -> Connection -> m [out]
- withConnection :: ByteString -> (Connection -> IO a) -> IO a
Documentation
type NumberOfRows = Int Source #
bulkSelectAllRows :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity)) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> Connection -> m [a Identity] Source #
Selects a given number of rows. Result returned as a list of plain Haskell records.
bulkSelectAllRowsWhere :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity)) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> (forall s. PostgresFilterLambda a s) -> Connection -> m [a Identity] Source #
Selects a given number of rows that satisfy a filter condition that is executed at the DB-level. Result returned as a list of plain Haskell records.
streamingSelectAllPipeline :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity), GenericVinyl (a Identity) a_names a_rs) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> ConduitT (Record (ZipTypes a_names a_rs)) out m () -> Connection -> m [out] Source #
Selects a given number of rows, and processes them using a user-provided
conduit
. User-provided conduit
takes in vinyl-records, and sends output
downstream. Result returned as a list of outputs of the conduit
.
streamingSelectAllPipeline' :: (Database Postgres b, Table a, MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres (a Identity), GenericVinyl (a Identity) a_names a_rs) => PostgresTable a b -> PostgresDB b -> NumberOfRows -> (forall s. PostgresFilterLambda a s) -> ConduitT (Record (ZipTypes a_names a_rs)) out m () -> Connection -> m [out] Source #
Similar as streamingSelectAllPipeline
, with an additional filterLambda
parameter that executes a SQL 'SELECT * FROM tbl WHERE' at the DB-level
prior to sending results downstream.
withConnection :: ByteString -> (Connection -> IO a) -> IO a Source #
Takes in the connection string, one of the the other 4 functions in
in this module with just the Connection
object unapplied. Internally,
it acquires the connection object using the string, passes it to the
function that performs an IO action, and then cleans up afterwards by
closing the database connection.