-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Backend for the persistent library using postgresql.
--
-- Based on the postgresql-simple package
@package persistent-postgresql
@version 2.2.1.1
-- | A postgresql backend for persistent.
module Database.Persist.Postgresql
-- | Create a PostgreSQL connection pool and run the given action. The pool
-- is properly released after the action finishes using it. Note that you
-- should not use the given ConnectionPool outside the action
-- since it may be already been released.
withPostgresqlPool :: (MonadBaseControl IO m, MonadLogger m, MonadIO m) => ConnectionString -> Int -> (ConnectionPool -> m a) -> m a
-- | Same as withPostgresqlPool, but instead of opening a pool of
-- connections, only one connection is opened.
withPostgresqlConn :: (MonadIO m, MonadBaseControl IO m, MonadLogger m) => ConnectionString -> (SqlBackend -> m a) -> m a
-- | Create a PostgreSQL connection pool. Note that it's your
-- responsibility to properly close the connection pool when unneeded.
-- Use withPostgresqlPool for an automatic resource control.
createPostgresqlPool :: (MonadIO m, MonadBaseControl IO m, MonadLogger m) => ConnectionString -> Int -> m ConnectionPool
-- | Same as createPostgresqlPool, but additionally takes a callback
-- function for some connection-specific tweaking to be performed after
-- connection creation. This could be used, for example, to change the
-- schema. For more information, see:
--
--
-- https://groups.google.com/d/msg/yesodweb/qUXrEN_swEo/O0pFwqwQIdcJ
--
-- Since 2.1.3
createPostgresqlPoolModified :: (MonadIO m, MonadBaseControl IO m, MonadLogger m) => (Connection -> IO ()) -> ConnectionString -> Int -> m ConnectionPool
-- | A libpq connection string. A simple example of connection
-- string would be "host=localhost port=5432 user=test dbname=test
-- password=test". Please read libpq's documentation at
-- http://www.postgresql.org/docs/9.1/static/libpq-connect.html
-- for more details on how to create such strings.
type ConnectionString = ByteString
-- | Information required to connect to a PostgreSQL database using
-- persistent's generic facilities. These values are the same
-- that are given to withPostgresqlPool.
data PostgresConf
PostgresConf :: ConnectionString -> Int -> PostgresConf
-- | The connection string.
[pgConnStr] :: PostgresConf -> ConnectionString
-- | How many connections should be held on the connection pool.
[pgPoolSize] :: PostgresConf -> Int
-- | Generate a Connection from a Connection
openSimpleConn :: LogFunc -> Connection -> IO SqlBackend
-- | get the SQL string for the table that a PeristEntity represents Useful
-- for raw SQL queries
tableName :: forall record. (PersistEntity record, PersistEntityBackend record ~ SqlBackend) => record -> Text
-- | get the SQL string for the field that an EntityField represents Useful
-- for raw SQL queries
fieldName :: forall record typ. (PersistEntity record, PersistEntityBackend record ~ SqlBackend) => EntityField record typ -> Text
-- | Mock a migration even when the database is not present. This function
-- performs the same functionality of printMigration with the
-- difference that an actualy database isn't needed for it.
mockMigration :: Migration -> IO ()
instance Data.Data.Data Database.Persist.Postgresql.PostgresConf
instance GHC.Read.Read Database.Persist.Postgresql.PostgresConf
instance GHC.Show.Show Database.Persist.Postgresql.PostgresConf
instance GHC.Classes.Ord Database.Persist.Postgresql.Unknown
instance GHC.Read.Read Database.Persist.Postgresql.Unknown
instance GHC.Show.Show Database.Persist.Postgresql.Unknown
instance GHC.Classes.Eq Database.Persist.Postgresql.Unknown
instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.P
instance Database.PostgreSQL.Simple.FromField.FromField Database.Persist.Postgresql.Unknown
instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.Unknown
instance Data.Aeson.Types.FromJSON.FromJSON Database.Persist.Postgresql.PostgresConf
instance Database.Persist.Class.PersistConfig.PersistConfig Database.Persist.Postgresql.PostgresConf