module Database.Relational.Query.Internal.Config (
NameConfig (..),
ProductUnitSupport (..), SchemaNameMode (..), IdentifierQuotation (..),
Config ( productUnitSupport
, chunksInsertSize
, schemaNameMode
, normalizedTableName
, verboseAsCompilerWarning
, identifierQuotation
, nameConfig),
defaultConfig,
) where
import Language.Haskell.TH.Name.CamelCase (VarName, varCamelcaseName)
import qualified Database.Record.TH as RecordTH
data NameConfig =
NameConfig
{ recordConfig :: RecordTH.NameConfig
, relationVarName :: String -> String -> VarName
}
instance Show NameConfig where
show = const "<NameConfig>"
data ProductUnitSupport = PUSupported | PUNotSupported deriving Show
data SchemaNameMode
= SchemaQualified
| SchemaNotQualified
deriving (Eq, Show)
data IdentifierQuotation = NoQuotation | Quotation Char deriving Show
data Config =
Config
{ productUnitSupport :: !ProductUnitSupport
, chunksInsertSize :: !Int
, schemaNameMode :: !SchemaNameMode
, normalizedTableName :: !Bool
, verboseAsCompilerWarning :: !Bool
, identifierQuotation :: !IdentifierQuotation
, nameConfig :: !NameConfig
} deriving Show
defaultConfig :: Config
defaultConfig =
Config { productUnitSupport = PUSupported
, chunksInsertSize = 256
, schemaNameMode = SchemaQualified
, normalizedTableName = True
, verboseAsCompilerWarning = False
, identifierQuotation = NoQuotation
, nameConfig = NameConfig { recordConfig = RecordTH.defaultNameConfig
, relationVarName = const varCamelcaseName
}
}