module Database.PostgreSQL.PQTypes.Transaction.Settings (
RestartPredicate(..)
, TransactionSettings(..)
, IsolationLevel(..)
, Permissions(..)
, def
) where
import Data.Default.Class
import Data.Typeable
import Prelude
import qualified Control.Exception as E
data RestartPredicate = forall e. E.Exception e
=> RestartPredicate (e -> Integer -> Bool)
deriving Typeable
instance Show RestartPredicate where
showsPrec _ RestartPredicate{} = (++) "RestartPredicate"
data TransactionSettings = TransactionSettings {
tsAutoTransaction :: !Bool
, tsIsolationLevel :: !IsolationLevel
, tsRestartPredicate :: !(Maybe RestartPredicate)
, tsPermissions :: !Permissions
} deriving (Show, Typeable)
data IsolationLevel = DefaultLevel | ReadCommitted | RepeatableRead | Serializable
deriving (Eq, Ord, Show, Typeable)
data Permissions = DefaultPermissions | ReadOnly | ReadWrite
deriving (Eq, Ord, Show, Typeable)
instance Default TransactionSettings where
def = TransactionSettings {
tsAutoTransaction = True
, tsIsolationLevel = DefaultLevel
, tsRestartPredicate = Nothing
, tsPermissions = DefaultPermissions
}