postgresql-transactional alternatives and similar packages
Based on the "postgresql" category.
Alternatively, view postgresql-transactional alternatives based on common mentions on social networks and blogs.
PostgreSQL Schema Migrations for Haskell
[Moved to: https://github.com/Simspace/postgresql-tx]
:question: Implementation of named parameters for `postgresql-simple` library
a PostgreSQL client library implemented with pure Haskell
Safe interpolated SQL queries in Haskell
TypedQuery flavour for postgresql-simple
An optparse-applicative parser for postgresql-simple's connection options
PostgreSQL error codes
A postgresql notifications library for libpq
Converter for question mark style and dollar sign style of PostgreSQL SQL.
postgresql-tx interfacing for use with monad-logger.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of postgresql-transactional or a related project?
postgresql-transactional is a simple monadic wrapper around the SQL
primitives introduced by the postgresql-simple package. It provides
simple and predictable semantics for database operations, enforces awareness of
Postgres's transactional nature at API boundaries, and obviates the need for
transaction boilerplate in SQL queries.
Though the primitives provided by the postgresql-simple package are
fast and powerful, their interface is (by design) very basic: specifically, all
query functions take a shared
Connection parameter and operate in the
query :: FromRow r => Connection -> Query -> IO [r] execute :: ToRow q => Connection -> Query -> q -> IO Int64
By virtue of the fact that (usually) all queries in a given scope are routed
through a single
Connection, we can abstract away the shared
parameter by wrapping a
ReaderT Connection in a monad transformer:
newtype PGTransactionT m a = PGTransactionT (ReaderT Postgres.Connection m a) deriving (Functor, Applicative, Monad, MonadTrans, MonadIO, MonadReader Postgres.Connection) type PGTransaction a = PGTransactionT IO a
In the common case, the
m parameter will simply be
IO. The library provides
the type alias
type PGTransaction a = PGTransactionT IO a to simplify type
signatures in these cases.
We can then reimplement our query functions in a more natural fashion:
query :: (FromRow r, MonadIO m) => Query -> PGTransactionT m [a] execute :: (ToRow q, MonadIO m) => Query -> q -> PGTransactionT m Int64
And we can then use the postgresql-simple
runPGTransaction, which executes a given
with rollback semantics:
runPGTransaction :: MonadBaseControl IO m => PGTransactionT m a -> Postgres.Connection -> m a
Use of the
MonadBaseControl IO m constraint leaves open the option of
embedding additional effects with the
m parameter, such as logging, state, or
We also provide a
PGTagged monad transformer that is equivalent to
PGTransaction, but includes
a phantom type in each relevant type signature that indicates whether said function has read-only
or write-enabled effects. This can be useful when dispatching read-only queries to Postgres replicas.
Helium Documentation and Community Support
Docs Complete documenation for all parts of Helium can be found at docs.helium.com.
chat.helium.com - If you have questions or ideas about how to use this code - or any part of Helium - head over the chat.helium.com. We're standing by to help.
postgresql-transactional was extracted from a production Haskell project at
Helium. It is open-source software © Helium Systems, Inc., and
released to the public under the terms of the MIT license.
*Note that all licence references and agreements mentioned in the postgresql-transactional README section above are relevant to that project's source code only.