module Database.PostgreSQL.PQTypes.Transaction.Settings (
RestartPredicate(..)
, TransactionSettings(..)
, IsolationLevel(..)
, Permissions(..)
, defaultTransactionSettings
) where
import qualified Control.Exception as E
data RestartPredicate = forall e. E.Exception e
=> RestartPredicate (e -> Integer -> Bool)
instance Show RestartPredicate where
showsPrec :: Int -> RestartPredicate -> ShowS
showsPrec Int
_ RestartPredicate{} = String -> ShowS
forall a. [a] -> [a] -> [a]
(++) String
"RestartPredicate"
data TransactionSettings = TransactionSettings
{
TransactionSettings -> Bool
tsAutoTransaction :: !Bool
, TransactionSettings -> IsolationLevel
tsIsolationLevel :: !IsolationLevel
, TransactionSettings -> Maybe RestartPredicate
tsRestartPredicate :: !(Maybe RestartPredicate)
, TransactionSettings -> Permissions
tsPermissions :: !Permissions
} deriving Int -> TransactionSettings -> ShowS
[TransactionSettings] -> ShowS
TransactionSettings -> String
(Int -> TransactionSettings -> ShowS)
-> (TransactionSettings -> String)
-> ([TransactionSettings] -> ShowS)
-> Show TransactionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransactionSettings] -> ShowS
$cshowList :: [TransactionSettings] -> ShowS
show :: TransactionSettings -> String
$cshow :: TransactionSettings -> String
showsPrec :: Int -> TransactionSettings -> ShowS
$cshowsPrec :: Int -> TransactionSettings -> ShowS
Show
data IsolationLevel = DefaultLevel | ReadCommitted | RepeatableRead | Serializable
deriving (IsolationLevel -> IsolationLevel -> Bool
(IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> Bool) -> Eq IsolationLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsolationLevel -> IsolationLevel -> Bool
$c/= :: IsolationLevel -> IsolationLevel -> Bool
== :: IsolationLevel -> IsolationLevel -> Bool
$c== :: IsolationLevel -> IsolationLevel -> Bool
Eq, Eq IsolationLevel
Eq IsolationLevel
-> (IsolationLevel -> IsolationLevel -> Ordering)
-> (IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> IsolationLevel)
-> (IsolationLevel -> IsolationLevel -> IsolationLevel)
-> Ord IsolationLevel
IsolationLevel -> IsolationLevel -> Bool
IsolationLevel -> IsolationLevel -> Ordering
IsolationLevel -> IsolationLevel -> IsolationLevel
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IsolationLevel -> IsolationLevel -> IsolationLevel
$cmin :: IsolationLevel -> IsolationLevel -> IsolationLevel
max :: IsolationLevel -> IsolationLevel -> IsolationLevel
$cmax :: IsolationLevel -> IsolationLevel -> IsolationLevel
>= :: IsolationLevel -> IsolationLevel -> Bool
$c>= :: IsolationLevel -> IsolationLevel -> Bool
> :: IsolationLevel -> IsolationLevel -> Bool
$c> :: IsolationLevel -> IsolationLevel -> Bool
<= :: IsolationLevel -> IsolationLevel -> Bool
$c<= :: IsolationLevel -> IsolationLevel -> Bool
< :: IsolationLevel -> IsolationLevel -> Bool
$c< :: IsolationLevel -> IsolationLevel -> Bool
compare :: IsolationLevel -> IsolationLevel -> Ordering
$ccompare :: IsolationLevel -> IsolationLevel -> Ordering
$cp1Ord :: Eq IsolationLevel
Ord, Int -> IsolationLevel -> ShowS
[IsolationLevel] -> ShowS
IsolationLevel -> String
(Int -> IsolationLevel -> ShowS)
-> (IsolationLevel -> String)
-> ([IsolationLevel] -> ShowS)
-> Show IsolationLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsolationLevel] -> ShowS
$cshowList :: [IsolationLevel] -> ShowS
show :: IsolationLevel -> String
$cshow :: IsolationLevel -> String
showsPrec :: Int -> IsolationLevel -> ShowS
$cshowsPrec :: Int -> IsolationLevel -> ShowS
Show)
data Permissions = DefaultPermissions | ReadOnly | ReadWrite
deriving (Permissions -> Permissions -> Bool
(Permissions -> Permissions -> Bool)
-> (Permissions -> Permissions -> Bool) -> Eq Permissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Permissions -> Permissions -> Bool
$c/= :: Permissions -> Permissions -> Bool
== :: Permissions -> Permissions -> Bool
$c== :: Permissions -> Permissions -> Bool
Eq, Eq Permissions
Eq Permissions
-> (Permissions -> Permissions -> Ordering)
-> (Permissions -> Permissions -> Bool)
-> (Permissions -> Permissions -> Bool)
-> (Permissions -> Permissions -> Bool)
-> (Permissions -> Permissions -> Bool)
-> (Permissions -> Permissions -> Permissions)
-> (Permissions -> Permissions -> Permissions)
-> Ord Permissions
Permissions -> Permissions -> Bool
Permissions -> Permissions -> Ordering
Permissions -> Permissions -> Permissions
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Permissions -> Permissions -> Permissions
$cmin :: Permissions -> Permissions -> Permissions
max :: Permissions -> Permissions -> Permissions
$cmax :: Permissions -> Permissions -> Permissions
>= :: Permissions -> Permissions -> Bool
$c>= :: Permissions -> Permissions -> Bool
> :: Permissions -> Permissions -> Bool
$c> :: Permissions -> Permissions -> Bool
<= :: Permissions -> Permissions -> Bool
$c<= :: Permissions -> Permissions -> Bool
< :: Permissions -> Permissions -> Bool
$c< :: Permissions -> Permissions -> Bool
compare :: Permissions -> Permissions -> Ordering
$ccompare :: Permissions -> Permissions -> Ordering
$cp1Ord :: Eq Permissions
Ord, Int -> Permissions -> ShowS
[Permissions] -> ShowS
Permissions -> String
(Int -> Permissions -> ShowS)
-> (Permissions -> String)
-> ([Permissions] -> ShowS)
-> Show Permissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Permissions] -> ShowS
$cshowList :: [Permissions] -> ShowS
show :: Permissions -> String
$cshow :: Permissions -> String
showsPrec :: Int -> Permissions -> ShowS
$cshowsPrec :: Int -> Permissions -> ShowS
Show)
defaultTransactionSettings :: TransactionSettings
defaultTransactionSettings :: TransactionSettings
defaultTransactionSettings =
TransactionSettings :: Bool
-> IsolationLevel
-> Maybe RestartPredicate
-> Permissions
-> TransactionSettings
TransactionSettings
{ tsAutoTransaction :: Bool
tsAutoTransaction = Bool
True
, tsIsolationLevel :: IsolationLevel
tsIsolationLevel = IsolationLevel
DefaultLevel
, tsRestartPredicate :: Maybe RestartPredicate
tsRestartPredicate = Maybe RestartPredicate
forall a. Maybe a
Nothing
, tsPermissions :: Permissions
tsPermissions = Permissions
DefaultPermissions
}