-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PostgreSQL Simple util tools. -- -- An easy way to use postgresql-simple library. @package psql-utils @version 0.2.0.0 module Database.PSQL.Config data PSQL PSQL :: String -> String -> Word16 -> String -> String -> Int -> NominalDiffTime -> Int -> Int -> PSQL [psqlDBName] :: PSQL -> String [psqlHost] :: PSQL -> String [psqlPort] :: PSQL -> Word16 [psqlUser] :: PSQL -> String [psqlPass] :: PSQL -> String -- | The number of stripes (distinct sub-pools) to maintain. [psqlPoolNumStrips] :: PSQL -> Int -- | Amount of time for which an unused resource is kept alive. [psqlPoolIdleTime] :: PSQL -> NominalDiffTime -- | Maximum number of resources to maintain per stripe. The [psqlPoolMaxResources] :: PSQL -> Int [psqlHaxlNumThreads] :: PSQL -> Int genPSQLPool :: PSQL -> IO (Pool Connection) instance GHC.Show.Show Database.PSQL.Config.PSQL instance Data.Aeson.Types.FromJSON.FromJSON Database.PSQL.Config.PSQL module Database.PSQL.Types data TablePrefix data Connection type PSQLPool = Pool Connection data PSQL a runPSQL :: TablePrefix -> Connection -> PSQL a -> IO a runPSQLPool :: TablePrefix -> PSQLPool -> PSQL a -> IO a runPSQLEnv :: HasPSQL env => env -> PSQL a -> IO a getTablePrefix :: PSQL TablePrefix class HasPSQL u psqlPool :: HasPSQL u => u -> PSQLPool tablePrefix :: HasPSQL u => u -> TablePrefix data SimpleEnv u simpleEnv :: Pool Connection -> TablePrefix -> u -> SimpleEnv u class HasOtherEnv u a otherEnv :: HasOtherEnv u a => a -> u data TableName getTableName :: TablePrefix -> TableName -> String type Columns = [Column] createTable :: TableName -> Columns -> PSQL Int64 constraintPrimaryKey :: TablePrefix -> TableName -> Columns -> Column getIndexName :: TablePrefix -> TableName -> IndexName -> String data IndexName createIndex :: Bool -> TableName -> IndexName -> Columns -> PSQL Int64 getOnly :: FromRow (Only a) => [Only a] -> Maybe a getOnlyDefault :: FromRow (Only a) => a -> [Only a] -> a insert :: ToRow a => TableName -> Columns -> a -> PSQL Int64 insertRet :: (ToRow a, FromRow (Only b)) => TableName -> Columns -> Column -> a -> b -> PSQL b insertOrUpdate :: ToRow a => TableName -> Columns -> Columns -> Columns -> a -> PSQL Int64 update :: ToRow a => TableName -> Columns -> String -> a -> PSQL Int64 delete :: ToRow a => TableName -> String -> a -> PSQL Int64 delete_ :: TableName -> PSQL Int64 count :: ToRow a => TableName -> String -> a -> PSQL Int64 count_ :: TableName -> PSQL Int64 select :: (ToRow a, FromRow b) => TableName -> Columns -> String -> a -> From -> Size -> OrderBy -> PSQL [b] selectOnly :: (ToRow a, FromRow (Only b)) => TableName -> Column -> String -> a -> From -> Size -> OrderBy -> PSQL [b] select_ :: FromRow b => TableName -> Columns -> From -> Size -> OrderBy -> PSQL [b] selectOnly_ :: FromRow (Only b) => TableName -> Column -> From -> Size -> OrderBy -> PSQL [b] selectOne :: (ToRow a, FromRow b) => TableName -> Columns -> String -> a -> PSQL (Maybe b) selectOneOnly :: (ToRow a, FromRow (Only b)) => TableName -> Column -> String -> a -> PSQL (Maybe b) type VersionList a = [Version a] mergeDatabase :: VersionList a -> PSQL () -- | A collection type that can be converted from a sequence of fields. -- Instances are provided for tuples up to 10 elements and lists of any -- length. -- -- Note that instances can be defined outside of postgresql-simple, which -- is often useful. For example, here's an instance for a user-defined -- pair: -- --
-- data User = User { name :: String, fileQuota :: Int }
--
-- instance FromRow User where
-- fromRow = User <$> field <*> field
--
--
-- The number of calls to field must match the number of fields
-- returned in a single row of the query result. Otherwise, a
-- ConversionFailed exception will be thrown.
--
-- You can also derive FromRow for your data type using GHC
-- generics, like this:
--
--
-- {-# LANGUAGE DeriveAnyClass #-}
-- {-# LANGUAGE DeriveGeneric #-}
--
-- import GHC.Generics (Generic)
-- import Database.PostgreSQL.Simple (FromRow)
--
-- data User = User { name :: String, fileQuota :: Int }
-- deriving (Generic, FromRow)
--
--
-- Note that this only works for product types (e.g. records) and does
-- not support sum types or recursive types.
--
-- Note that field evaluates its result to WHNF, so the caveats
-- listed in mysql-simple and very early versions of postgresql-simple no
-- longer apply. Instead, look at the caveats associated with
-- user-defined implementations of fromField.
class FromRow a
fromRow :: FromRow a => RowParser a
field :: FromField a => RowParser a
-- | The 1-tuple type or single-value "collection".
--
-- This type is structurally equivalent to the Identity type, but
-- its intent is more about serving as the anonymous 1-tuple type missing
-- from Haskell for attaching typeclass instances.
--
-- Parameter usage example:
--
-- -- encodeSomething (Only (42::Int)) ---- -- Result usage example: -- --
-- xs <- decodeSomething
-- forM_ xs $ \(Only id) -> {- ... -}
--
newtype Only a
Only :: a -> Only a
[fromOnly] :: Only a -> a
data SqlError
SqlError :: ByteString -> ExecStatus -> ByteString -> ByteString -> ByteString -> SqlError
[sqlState] :: SqlError -> ByteString
[sqlExecStatus] :: SqlError -> ExecStatus
[sqlErrorMsg] :: SqlError -> ByteString
[sqlErrorDetail] :: SqlError -> ByteString
[sqlErrorHint] :: SqlError -> ByteString
data OrderBy
asc :: String -> OrderBy
desc :: String -> OrderBy
none :: OrderBy
instance GHC.Classes.Eq Database.PSQL.Types.OrderBy
instance GHC.Generics.Generic Database.PSQL.Types.OrderBy
instance GHC.Show.Show Database.PSQL.Types.IndexName
instance GHC.Show.Show Database.PSQL.Types.Column
instance GHC.Show.Show Database.PSQL.Types.TableName
instance GHC.Show.Show Database.PSQL.Types.TablePrefix
instance Data.Hashable.Class.Hashable Database.PSQL.Types.OrderBy
instance GHC.Show.Show Database.PSQL.Types.OrderBy
instance Data.String.IsString Database.PSQL.Types.IndexName
instance Data.String.IsString Database.PSQL.Types.Column
instance Data.String.IsString Database.PSQL.Types.TableName
instance Database.PSQL.Types.HasPSQL (Database.PSQL.Types.SimpleEnv u)
instance Database.PSQL.Types.HasOtherEnv u (Database.PSQL.Types.SimpleEnv u)
instance GHC.Base.Functor Database.PSQL.Types.PSQL
instance GHC.Base.Applicative Database.PSQL.Types.PSQL
instance GHC.Base.Monad Database.PSQL.Types.PSQL
instance Control.Monad.IO.Class.MonadIO Database.PSQL.Types.PSQL
instance Data.String.IsString Database.PSQL.Types.TablePrefix