Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Mode
- data IsolationLevel
- data Transaction a
- run :: Transaction a -> IsolationLevel -> Mode -> Connection -> IO (Either ResultsError a)
- query :: a -> Query a b -> Transaction b
Transaction settings
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. |
data IsolationLevel Source
For reference see the Postgres' documentation.
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.