yesod/yesod/scaffold/postgresqlConnPool.cg
patrick brisbin fa3fabcfba Update scaffolding with new load connection functions
Yesod.Settings provides load functions which were previously scaffolded.
They load the ConsStrs for SQL and ConnParams for Mongo.

This prevents the need for a lot of the imports in the scaffolding
settings and simplifies the existing Text import.
2011-09-11 14:57:06 -04:00

14 lines
562 B
Plaintext

runConnectionPool :: MonadControlIO m => SqlPersist m a -> ConnectionPool -> m a
runConnectionPool = runSqlPool
withConnectionPool :: MonadControlIO m => AppConfig -> (ConnectionPool -> m a) -> m a
withConnectionPool conf f = do
cs <- liftIO $ load~upper~ConnStr (appEnv conf)
with~upper~Pool cs (connectionPoolSize conf) 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