hasql-transaction-0.4.5.1: 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.

Instances

Bounded Mode Source # 
Enum Mode Source # 

Methods

succ :: Mode -> Mode #

pred :: Mode -> Mode #

toEnum :: Int -> Mode #

fromEnum :: Mode -> Int #

enumFrom :: Mode -> [Mode] #

enumFromThen :: Mode -> Mode -> [Mode] #

enumFromTo :: Mode -> Mode -> [Mode] #

enumFromThenTo :: Mode -> Mode -> Mode -> [Mode] #

Eq Mode Source # 

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Ord Mode Source # 

Methods

compare :: Mode -> Mode -> Ordering #

(<) :: Mode -> Mode -> Bool #

(<=) :: Mode -> Mode -> Bool #

(>) :: Mode -> Mode -> Bool #

(>=) :: Mode -> Mode -> Bool #

max :: Mode -> Mode -> Mode #

min :: Mode -> Mode -> Mode #

Show Mode Source # 

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

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.