hasql/library/Hasql.hs

74 lines
1.7 KiB
Haskell
Raw Normal View History

2014-10-18 00:03:02 +04:00
module Hasql
2014-10-16 19:52:49 +04:00
(
-- * Pool
Pool.Pool,
Pool.Settings(..),
Pool.withPool,
-- * Transaction
Transaction.Transaction,
-- ** Execution
-- |
-- Functions for execution of transactions.
-- They determine the transactional locking strategy of the database.
2014-10-21 01:58:12 +04:00
TransactionRunner,
2014-10-20 02:53:33 +04:00
withoutLocking,
read,
write,
2014-10-16 19:52:49 +04:00
-- ** Transactions
2014-10-21 01:58:12 +04:00
Transaction.StatementRunner,
2014-10-22 18:22:02 +04:00
Transaction.unitTx,
Transaction.countTx,
Transaction.streamTx,
Transaction.cursorStreamTx,
2014-10-16 19:52:49 +04:00
-- ** Statement Quasi-Quoter
QQ.q,
-- ** Error
Transaction.Error(..),
-- ** Isolation
Backend.IsolationLevel(..),
-- ** Locking Levels
Transaction.WithoutLocking,
Transaction.Read,
Transaction.Write,
-- ** Privileges
Transaction.CursorsPrivilege,
2014-10-21 01:58:12 +04:00
Transaction.WritingPrivilege,
2014-10-16 19:52:49 +04:00
-- ** Results Stream
Transaction.ResultsStream,
Transaction.TransactionListT,
-- ** Backend
Backend.Backend,
Backend.Mapping,
-- ** Row parser
RowParser.RowParser,
)
where
2014-10-20 02:53:33 +04:00
import Hasql.Prelude hiding (read)
2014-10-18 00:03:02 +04:00
import qualified Hasql.Backend as Backend
import qualified Hasql.Transaction as Transaction
import qualified Hasql.Pool as Pool
import qualified Hasql.RowParser as RowParser
import qualified Hasql.QQ as QQ
2014-10-16 19:52:49 +04:00
2014-10-21 01:58:12 +04:00
type TransactionRunner l =
forall b r. Backend.Backend b =>
(forall s. Transaction.Transaction b l s r) -> Pool.Pool b -> IO r
withoutLocking :: TransactionRunner Transaction.WithoutLocking
2014-10-20 02:53:33 +04:00
withoutLocking t =
2014-10-16 19:52:49 +04:00
Pool.withConnection (Transaction.runWithoutLocking t)
2014-10-21 01:58:12 +04:00
read :: Backend.IsolationLevel -> TransactionRunner Transaction.Read
2014-10-20 02:53:33 +04:00
read i t =
2014-10-16 19:52:49 +04:00
Pool.withConnection (Transaction.runRead i t)
2014-10-21 01:58:12 +04:00
write :: Backend.IsolationLevel -> TransactionRunner Transaction.Write
2014-10-20 02:53:33 +04:00
write i t =
2014-10-16 19:52:49 +04:00
Pool.withConnection (Transaction.runWrite i t)
2014-10-21 01:58:12 +04:00