Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class PersistConfig c where
- type PersistConfigBackend c :: (Type -> Type) -> Type -> Type
- type PersistConfigPool c
- loadConfig :: Value -> Parser c
- applyEnv :: c -> IO c
- createPoolConfig :: c -> IO (PersistConfigPool c)
- runPool :: MonadUnliftIO m => c -> PersistConfigBackend c m a -> PersistConfigPool c -> m a
Documentation
class PersistConfig c where Source #
Represents a value containing all the configuration options for a specific backend. This abstraction makes it easier to write code that can easily swap backends.
type PersistConfigBackend c :: (Type -> Type) -> Type -> Type Source #
type PersistConfigPool c Source #
loadConfig :: Value -> Parser c Source #
Load the config settings from a Value
, most likely taken from a YAML
config file.
applyEnv :: c -> IO c Source #
Modify the config settings based on environment variables.
createPoolConfig :: c -> IO (PersistConfigPool c) Source #
Create a new connection pool based on the given config settings.
runPool :: MonadUnliftIO m => c -> PersistConfigBackend c m a -> PersistConfigPool c -> m a Source #
Run a database action by taking a connection from the pool.
Instances
(PersistConfig c1, PersistConfig c2, PersistConfigPool c1 ~ PersistConfigPool c2, PersistConfigBackend c1 ~ PersistConfigBackend c2) => PersistConfig (Either c1 c2) Source # | |
Defined in Database.Persist.Class.PersistConfig type PersistConfigBackend (Either c1 c2) :: (Type -> Type) -> Type -> Type Source # type PersistConfigPool (Either c1 c2) Source # loadConfig :: Value -> Parser (Either c1 c2) Source # applyEnv :: Either c1 c2 -> IO (Either c1 c2) Source # createPoolConfig :: Either c1 c2 -> IO (PersistConfigPool (Either c1 c2)) Source # runPool :: MonadUnliftIO m => Either c1 c2 -> PersistConfigBackend (Either c1 c2) m a -> PersistConfigPool (Either c1 c2) -> m a Source # |