yesod/yesod/scaffold/postgresqlConnPool.cg
2011-09-21 18:52:57 -04:00

14 lines
580 B
Plaintext

runConnectionPool :: MonadControlIO m => SqlPersist m a -> ConnectionPool -> m a
runConnectionPool = runSqlPool
withConnectionPool :: MonadControlIO m => AppConfig DefaultEnv -> (ConnectionPool -> m a) -> m a
withConnectionPool conf f = do
dbConf <- liftIO $ load~upper~ (appEnv conf)
with~upper~Pool (pgConnStr dbConf) (pgPoolSize dbConf) f
-- Example of making a dynamic configuration static
-- use /return $(mkConnStr Production)/ instead of loadConnStr
-- mkConnStr :: AppEnvironment -> Q Exp
-- mkConnStr env = qRunIO (loadConnStr env) >>= return . LitE . StringL