postgresql-transactional-1.0.0: a transactional monad on top of postgresql-simple

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Transaction

Synopsis

Documentation

type PGTransaction = PGTransactionT IO Source

runPGTransactionT :: MonadBaseControl IO m => PGTransactionT m a -> Connection -> m a Source

runPGTransactionT' :: MonadBaseControl IO m => IsolationLevel -> PGTransactionT m a -> Connection -> m a Source

runPGTransactionIO :: MonadIO m => PGTransaction a -> Connection -> m a Source

Convenience function when there are no embedded monadic effects, only IO.

query :: (ToRow input, FromRow output, MonadIO m) => input -> Query -> PGTransactionT m [output] Source

Issue an SQL query, taking a ToRow input and yielding FromRow outputs. Please note that the parameter order is different from that in the parent postgresql-simple library; this is an intentional choice to improve the aesthetics when using the SQL quasiquoter (making the query parameters come first means that there is more room for the query string).

query_ :: (FromRow output, MonadIO m) => Query -> PGTransactionT m [output] Source

As query, but for queries that take no arguments.

execute :: (ToRow input, MonadIO m) => input -> Query -> PGTransactionT m Int64 Source

Run a single SQL action and return success.

executeOne :: (ToRow input, MonadIO m) => input -> Query -> PGTransactionT m Bool Source

Run a statement and return True if only a single record was modified.

executeMany :: (ToRow input, MonadIO m) => [input] -> Query -> PGTransactionT m Int64 Source

returning :: (ToRow input, FromRow output, MonadIO m) => [input] -> Query -> PGTransactionT m [output] Source

queryHead :: (ToRow input, FromRow output, MonadIO m) => input -> Query -> PGTransactionT m (Maybe output) Source

Run a query and return Just the first result found or Nothing.

queryOnly :: (ToRow input, FromField f, MonadIO m) => input -> Query -> PGTransactionT m (Maybe f) Source

Lookup a single FromField value. This takes care of handling Only for you.

formatQuery :: (ToRow input, MonadIO m) => input -> Query -> PGTransactionT m Query Source