heroku-persistent 0.1.0 → 0.2.0
raw patch · 3 files changed
+11/−4 lines, 3 filessetup-changednew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Web.Heroku.Persist.Postgresql: fromDatabaseUrl :: Int -> String -> PostgresConf
Files
- Setup.hs +0/−2
- heroku-persistent.cabal +1/−1
- src/Web/Heroku/Persist/Postgresql.hs +10/−1
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
heroku-persistent.cabal view
@@ -1,5 +1,5 @@ name: heroku-persistent-version: 0.1.0+version: 0.2.0 author: Pat Brisbin <pbrisbin@gmail.com> maintainer: Pat Brisbin <pbrisbin@gmail.com> license: MIT
src/Web/Heroku/Persist/Postgresql.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Web.Heroku.Persist.Postgresql ( postgresConf+ , fromDatabaseUrl ) where import Control.Applicative ((<$>))@@ -10,10 +11,11 @@ import Data.Monoid ((<>)) import Database.Persist.Postgresql (PostgresConf(..)) import Web.Heroku (dbConnParams)+import Web.Heroku.Postgres (dbConnParams, parseDatabaseUrl) import qualified Data.Text as T --- | Build a @'PostgresConf'@ by parsing @DATABASE_URL@+-- | Build a @'PostgresConf'@ by parsing @ENV[DATABASE_URL]@ postgresConf :: Int -> IO PostgresConf postgresConf size = do connStr <- formatParams <$> dbConnParams@@ -22,6 +24,13 @@ { pgConnStr = connStr , pgPoolSize = size }++-- | Build a @'PostgresConf'@ by parsing a database URL String+fromDatabaseUrl :: Int -> String -> PostgresConf+fromDatabaseUrl size url = PostgresConf+ { pgConnStr = formatParams $ parseDatabaseUrl url+ , pgPoolSize = size+ } formatParams :: [(Text, Text)] -> ByteString formatParams = encodeUtf8 . T.unwords . map toKeyValue