beam-postgres-0.3.2.0: Connection layer between beam and postgres

Safe HaskellNone
LanguageHaskell2010

Database.Beam.Postgres.Conduit

Contents

Description

More efficient query execution functions for beam-postgres. These functions use the conduit package, to execute beam-postgres statements in an arbitrary MonadIO. These functions may be more efficient for streaming operations than MonadBeam.

Synopsis

SELECT

runSelect :: (MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> SqlSelect PgSelectSyntax a -> (ConduitT () a m () -> m b) -> m b Source #

Run a PostgreSQL SELECT statement in any MonadIO.

INSERT

runInsert :: MonadIO m => Connection -> SqlInsert PgInsertSyntax -> m Int64 Source #

Run a PostgreSQL INSERT statement in any MonadIO. Returns the number of rows affected.

runInsertReturning :: (MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgInsertReturning a -> (ConduitT () a m () -> m b) -> m b Source #

Run a PostgreSQL INSERT ... RETURNING ... statement in any MonadIO and get a Source of the newly inserted rows.

UPDATE

runUpdate :: MonadIO m => Connection -> SqlUpdate PgUpdateSyntax tbl -> m Int64 Source #

Run a PostgreSQL UPDATE statement in any MonadIO. Returns the number of rows affected.

runUpdateReturning :: (MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgUpdateReturning a -> (ConduitT () a m () -> m b) -> m b Source #

Run a PostgreSQL UPDATE ... RETURNING ... statement in any MonadIO and get a Source of the newly updated rows.

DELETE

runDelete :: MonadIO m => Connection -> SqlDelete PgDeleteSyntax tbl -> m Int64 Source #

Run a PostgreSQL DELETE statement in any MonadIO. Returns the number of rows affected.

runDeleteReturning :: (MonadIO m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgDeleteReturning a -> (ConduitT () a m () -> m b) -> m b Source #

Run a PostgreSQl DELETE ... RETURNING ... statement in any MonadIO and get a Source of the deleted rows.

Convenience functions

executeStatement :: MonadIO m => Connection -> PgSyntax -> m Int64 Source #

Run any DML statement. Return the number of rows affected

runQueryReturning :: (MonadIO m, MonadBaseControl IO m, Functor m, FromBackendRow Postgres r) => Connection -> PgSyntax -> (ConduitT () r m () -> m b) -> m b Source #

Runs any query that returns a set of values