-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A composable abstraction over the retryable transactions for Hasql
--   
--   A composable abstraction over the retryable transactions for Hasql
@package hasql-transaction
@version 0.5

module Hasql.Transaction.Sessions

-- | Execute the transaction using the provided isolation level and mode.
transaction :: IsolationLevel -> Mode -> Transaction a -> Session a


-- | An API for declaration of transactions.
module Hasql.Transaction
data Mode

-- | Read-only. No writes possible.
Read :: Mode

-- | Write and commit.
Write :: Mode

-- | For reference see <a>the Postgres' documentation</a>.
data IsolationLevel
ReadCommitted :: IsolationLevel
RepeatableRead :: IsolationLevel
Serializable :: IsolationLevel

-- | A composable abstraction over the retryable transactions.
--   
--   Executes multiple queries under the specified mode and isolation
--   level, while automatically retrying the transaction in case of
--   conflicts. Thus this abstraction closely reproduces the behaviour of
--   <a>STM</a>.
data Transaction a

-- | Cause transaction to eventually roll back.
condemn :: Transaction ()

-- | Possibly a multi-statement query, which however cannot be
--   parameterized or prepared, nor can any results of it be collected.
sql :: ByteString -> Transaction ()

-- | Parameters and a specification of the parametric query to apply them
--   to.
query :: a -> Query a b -> Transaction b
