hasql-transaction-0.4.5: 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 -> Session a Source

Execute the transaction using the provided isolation level and mode.

sql :: ByteString -> Transaction () Source

Possibly a multi-statement query, which however cannot be parameterized or prepared, nor can any results of it be collected.

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

Parameters and a specification of the parametric query to apply them to.