-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Start and stop a temporary postgres for testing -- -- This module provides functions greating a temporary postgres instance -- on a random port for testing. -- --
--   result <- start []
--   case result of
--     Left err -> print err
--     Right tempDB -> do
--       -- Do stuff
--       stop tempDB
--   
-- -- The are few different methods for starting postgres which -- provide different methods of dealing with stdout and -- stderr. -- -- The start methods use a config based on the one used by pg_tmp -- (http:/ephemeralpg.org), but can be overriden by in different -- values to the first argument of the start functions. -- -- WARNING!! Ubuntu's PostgreSQL installation does not put -- initdb on the PATH. We need to add it manually. The -- necessary binaries are in the -- /usr/lib/postgresql/VERSION/bin/ directory, and should be -- added to the PATH -- --
--   echo "export PATH=$PATH:/usr/lib/postgresql/VERSION/bin/" >> /home/ubuntu/.bashrc
--   
@package tmp-postgres @version 0.1.0.7 module Database.Postgres.Temp.Internal openFreePort :: IO Int waitForDB :: FilePath -> Int -> IO () data DB DB :: FilePath -> String -> ProcessHandle -> DB -- | Temporary directory where the unix socket, logs and data directory -- live. [mainDir] :: DB -> FilePath -- | PostgreSQL connection string. [connectionString] :: DB -> String -- | The process handle for the postgres process. [pid] :: DB -> ProcessHandle -- | start postgres and use the current processes stdout and stderr start :: [(String, String)] -> IO (Either StartError DB) fourth :: (a, b, c, d) -> d shellWith :: Handle -> Handle -> String -> CreateProcess config :: FilePath -> String data StartError InitDBFailed :: ExitCode -> StartError CreateDBFailed :: ExitCode -> StartError throwIfError :: (ExitCode -> StartError) -> ExitCode -> IO () pidString :: ProcessHandle -> IO String runProcessWith :: Handle -> Handle -> String -> String -> IO ExitCode -- | Start postgres and pass in handles for stdout and stderr startWithHandles :: [(String, String)] -> Handle -> Handle -> IO (Either StartError DB) startWithHandlesAndDir :: [(String, String)] -> FilePath -> Handle -> Handle -> IO (Either StartError DB) data Event InitDB :: Event WriteConfig :: Event FreePort :: Event StartPostgres :: Event WaitForDB :: Event CreateDB :: Event Finished :: Event rmDirIgnoreErrors :: FilePath -> IO () startWithLogger :: (Event -> IO ()) -> [(String, String)] -> FilePath -> Handle -> Handle -> IO (Either StartError DB) -- | Start postgres and log it's all stdout to {mainDir}/output.txt -- and {mainDir}/error.txt startAndLogToTmp :: [(String, String)] -> IO (Either StartError DB) -- | Stop postgres and clean up the temporary database folder. stop :: DB -> IO ExitCode instance GHC.Classes.Ord Database.Postgres.Temp.Internal.Event instance GHC.Enum.Bounded Database.Postgres.Temp.Internal.Event instance GHC.Enum.Enum Database.Postgres.Temp.Internal.Event instance GHC.Classes.Eq Database.Postgres.Temp.Internal.Event instance GHC.Show.Show Database.Postgres.Temp.Internal.Event instance GHC.Classes.Eq Database.Postgres.Temp.Internal.StartError instance GHC.Show.Show Database.Postgres.Temp.Internal.StartError instance GHC.Exception.Exception Database.Postgres.Temp.Internal.StartError -- | This module provides functions greating a temporary postgres instance -- on a random port for testing. -- --
--   result <- start []
--   case result of
--     Left err -> print err
--     Right tempDB -> do
--        -- Do stuff
--        stop tempDB
--   
-- -- The are few different methods for starting postgres which -- provide different methods of dealing with stdout and -- stderr. -- -- The start methods use a config based on the one used by pg_tmp, -- but can be overriden by in different values to the first argument of -- the start functions. -- -- WARNING!! Ubuntu's PostgreSQL installation does not put -- initdb on the PATH. We need to add it manually. The -- necessary binaries are in the -- /usr/lib/postgresql/VERSION/bin/ directory, and should be -- added to the PATH -- --
--   echo "export PATH=$PATH:/usr/lib/postgresql/VERSION/bin/" >> /home/ubuntu/.bashrc
--   
module Database.Postgres.Temp data DB DB :: FilePath -> String -> ProcessHandle -> DB -- | Temporary directory where the unix socket, logs and data directory -- live. [mainDir] :: DB -> FilePath -- | PostgreSQL connection string. [connectionString] :: DB -> String -- | The process handle for the postgres process. [pid] :: DB -> ProcessHandle data StartError InitDBFailed :: ExitCode -> StartError CreateDBFailed :: ExitCode -> StartError -- | start postgres and use the current processes stdout and stderr start :: [(String, String)] -> IO (Either StartError DB) -- | Start postgres and log it's all stdout to {mainDir}/output.txt -- and {mainDir}/error.txt startAndLogToTmp :: [(String, String)] -> IO (Either StartError DB) -- | Start postgres and pass in handles for stdout and stderr startWithHandles :: [(String, String)] -> Handle -> Handle -> IO (Either StartError DB) -- | Stop postgres and clean up the temporary database folder. stop :: DB -> IO ExitCode