postgres-embedded 0.1.0 → 0.1.1
raw patch · 4 files changed
+11/−14 lines, 4 filesdep +networkdep −HDBCdep −HDBC-postgresqlPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: network
Dependencies removed: HDBC, HDBC-postgresql
API changes (from Hackage documentation)
- Database.PostgreSQL.Embedded: DBConfig :: Int -> String -> DBConfig
+ Database.PostgreSQL.Embedded: DBConfig :: Integer -> String -> DBConfig
- Database.PostgreSQL.Embedded: [port] :: DBConfig -> Int
+ Database.PostgreSQL.Embedded: [port] :: DBConfig -> Integer
Files
- postgres-embedded.cabal +2/−3
- src/Database/PostgreSQL/Embedded/Postgres.hs +7/−7
- src/Database/PostgreSQL/Embedded/Types.hs +1/−1
- test/Spec.hs +1/−3
postgres-embedded.cabal view
@@ -1,5 +1,5 @@ name: postgres-embedded-version: 0.1.0+version: 0.1.1 description: Library for easily running embedded PostgreSQL server for tests homepage: https://github.com/ilya-murzinov/postgres-embedded license: MIT@@ -22,8 +22,7 @@ , directory , filepath , shell-conduit- , HDBC- , HDBC-postgresql+ , network ghc-options: -Wall default-language: Haskell2010
src/Database/PostgreSQL/Embedded/Postgres.hs view
@@ -5,16 +5,17 @@ ) where import Control.Concurrent (threadDelay)-import Control.Exception (try)+import Control.Exception (SomeException, try) import Data.Conduit.Shell (rm, run, shell) import Data.List (isInfixOf) import Data.Monoid ((<>))-import Database.HDBC (SqlError)-import Database.HDBC.PostgreSQL (Connection,- connectPostgreSQL)+import Network (PortID (..), connectTo) import System.FilePath.Posix ((</>)) import System.Info (os)+import System.IO (Handle) ++ import Database.PostgreSQL.Embedded.Download import Database.PostgreSQL.Embedded.Types @@ -43,11 +44,10 @@ checkPostgresStarted config secs = checkPostgresStarted_ config secs >>= \_ -> return () where checkPostgresStarted_ :: DBConfig -> Int -> IO Bool- checkPostgresStarted_ (DBConfig p u) n = do- let connStr = "postgres://" <> u <> "@localhost:" <> (show p) <> "/postgres"+ checkPostgresStarted_ (DBConfig p _) n = do let oneSec = 1000000 - res <- try $ connectPostgreSQL connStr :: IO (Either SqlError Connection)+ res <- try $ connectTo "localhost" (PortNumber $ fromInteger p) :: IO (Either SomeException Handle) case res of Left e -> if (n > 0) then print e >>=
src/Database/PostgreSQL/Embedded/Types.hs view
@@ -21,6 +21,6 @@ } data DBConfig = DBConfig {- port :: Int,+ port :: Integer, username :: String }
test/Spec.hs view
@@ -1,5 +1,3 @@-import System.Info as SI (os)- import Database.PostgreSQL.Embedded main :: IO ()@@ -13,4 +11,4 @@ -- Start Postgres with cached distribution rc1 <- startPostgres sConfig dConfig- stopPostgres rc+ stopPostgres rc1