{-# LANGUAGE OverloadedStrings #-}
module Hasql.Private.Types where
import ByteString.TreeBuilder (Builder)
data IsolationLevel
= ReadCommitted
| RepeatableRead
| Serializable
deriving (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
$cshowsPrec :: Int -> IsolationLevel -> ShowS
showsPrec :: Int -> IsolationLevel -> ShowS
$cshow :: IsolationLevel -> String
show :: IsolationLevel -> String
$cshowList :: [IsolationLevel] -> ShowS
showList :: [IsolationLevel] -> ShowS
Show, IsolationLevel -> IsolationLevel -> Bool
(IsolationLevel -> IsolationLevel -> Bool)
-> (IsolationLevel -> IsolationLevel -> Bool) -> Eq IsolationLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IsolationLevel -> IsolationLevel -> Bool
== :: IsolationLevel -> IsolationLevel -> Bool
$c/= :: IsolationLevel -> IsolationLevel -> Bool
/= :: IsolationLevel -> IsolationLevel -> Bool
Eq)
isolationLevelToSQL :: IsolationLevel -> Builder
isolationLevelToSQL :: IsolationLevel -> Builder
isolationLevelToSQL = \case
IsolationLevel
ReadCommitted -> Builder
"READ COMMITTED"
IsolationLevel
RepeatableRead -> Builder
"REPEATABLE READ"
IsolationLevel
Serializable -> Builder
"SERIALIZABLE"
data Mode = ReadWrite | ReadOnly
deriving (Int -> Mode -> ShowS
[Mode] -> ShowS
Mode -> String
(Int -> Mode -> ShowS)
-> (Mode -> String) -> ([Mode] -> ShowS) -> Show Mode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Mode -> ShowS
showsPrec :: Int -> Mode -> ShowS
$cshow :: Mode -> String
show :: Mode -> String
$cshowList :: [Mode] -> ShowS
showList :: [Mode] -> ShowS
Show, Mode -> Mode -> Bool
(Mode -> Mode -> Bool) -> (Mode -> Mode -> Bool) -> Eq Mode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Mode -> Mode -> Bool
== :: Mode -> Mode -> Bool
$c/= :: Mode -> Mode -> Bool
/= :: Mode -> Mode -> Bool
Eq)
modeToSQL :: Mode -> Builder
modeToSQL :: Mode -> Builder
modeToSQL = \case
Mode
ReadWrite -> Builder
"READ WRITE"
Mode
ReadOnly -> Builder
"READ ONLY"
data Deferrable = Deferrable | NotDeferrable
deriving (Int -> Deferrable -> ShowS
[Deferrable] -> ShowS
Deferrable -> String
(Int -> Deferrable -> ShowS)
-> (Deferrable -> String)
-> ([Deferrable] -> ShowS)
-> Show Deferrable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Deferrable -> ShowS
showsPrec :: Int -> Deferrable -> ShowS
$cshow :: Deferrable -> String
show :: Deferrable -> String
$cshowList :: [Deferrable] -> ShowS
showList :: [Deferrable] -> ShowS
Show, Deferrable -> Deferrable -> Bool
(Deferrable -> Deferrable -> Bool)
-> (Deferrable -> Deferrable -> Bool) -> Eq Deferrable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Deferrable -> Deferrable -> Bool
== :: Deferrable -> Deferrable -> Bool
$c/= :: Deferrable -> Deferrable -> Bool
/= :: Deferrable -> Deferrable -> Bool
Eq)
deferrableToSQL :: Deferrable -> Builder
deferrableToSQL :: Deferrable -> Builder
deferrableToSQL = \case
Deferrable
Deferrable -> Builder
"DEFERRABLE"
Deferrable
NotDeferrable -> Builder
"NOT DEFERRABLE"