Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Mode
- data IsolationLevel
- data Transaction a
- run :: Transaction a -> IsolationLevel -> Mode -> Session a
- sql :: ByteString -> Transaction ()
- 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 -> 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.