hasql-transaction-0.3.0.3: A composable abstraction over the retryable transactions for Hasql

Safe HaskellNone
LanguageHaskell2010

Hasql.Transaction

Contents

Synopsis

Transaction settings

data Mode Source

Constructors

Read

Read-only. No writes possible.

Write

Write and commit.

WriteWithoutCommitting

Write without committing. Useful for testing, allowing you to modify your database, producing some result based on your changes, and letting Hasql roll all the changes back on the exit from the transaction.

Transaction monad

data Transaction a Source

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 STM.

run :: Transaction a -> IsolationLevel -> Mode -> Connection -> IO (Either ResultsError a) Source

Execute the transaction using the provided isolation level, mode and a database connection.

query :: a -> Query a b -> Transaction b Source

Execute a query in the context of a transaction.