-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | pure Haskell PostgreSQL driver -- -- pure Haskell PostgreSQL driver @package postgresql-pure @version 0.2.3.0 module Database.PostgreSQL.Pure.Oid -- | OID. -- -- Constant values are listed in Database.PostgreSQL.Pure.Oid. newtype Oid Oid :: Int32 -> Oid _daterange :: Oid _int4range :: Oid _int8range :: Oid _numrange :: Oid _tsrange :: Oid _tstzrange :: Oid bit :: Oid bitArray :: Oid bool :: Oid boolArray :: Oid box :: Oid boxArray :: Oid bpchar :: Oid bpcharArray :: Oid bytea :: Oid byteaArray :: Oid char :: Oid charArray :: Oid cid :: Oid cidArray :: Oid cidr :: Oid cidrArray :: Oid circle :: Oid circleArray :: Oid date :: Oid dateArray :: Oid daterange :: Oid float4 :: Oid float4Array :: Oid float8 :: Oid float8Array :: Oid inet :: Oid inetArray :: Oid int2 :: Oid int2Array :: Oid int2vector :: Oid int2vectorArray :: Oid int4 :: Oid int4Array :: Oid int4range :: Oid int8 :: Oid int8Array :: Oid int8range :: Oid interval :: Oid intervalArray :: Oid json :: Oid jsonArray :: Oid jsonb :: Oid jsonbArray :: Oid line :: Oid lineArray :: Oid lseg :: Oid lsegArray :: Oid macaddr :: Oid macaddrArray :: Oid money :: Oid moneyArray :: Oid name :: Oid nameArray :: Oid numeric :: Oid numericArray :: Oid numrange :: Oid oid :: Oid oidArray :: Oid oidvector :: Oid oidvectorArray :: Oid path :: Oid pathArray :: Oid point :: Oid pointArray :: Oid polygon :: Oid polygonArray :: Oid record :: Oid recordArray :: Oid refcursor :: Oid refcursorArray :: Oid regclass :: Oid regclassArray :: Oid regoper :: Oid regoperArray :: Oid regoperator :: Oid regoperatorArray :: Oid regproc :: Oid regprocArray :: Oid regprocedure :: Oid regprocedureArray :: Oid regtype :: Oid regtypeArray :: Oid sqlIdentifier :: Oid text :: Oid textArray :: Oid tid :: Oid tidArray :: Oid time :: Oid timeArray :: Oid timestamp :: Oid timestampArray :: Oid timestamptz :: Oid timestamptzArray :: Oid timetz :: Oid timetzArray :: Oid tsrange :: Oid tstzrange :: Oid unknown :: Oid uuid :: Oid uuidArray :: Oid varbit :: Oid varbitArray :: Oid varchar :: Oid varcharArray :: Oid void :: Oid xid :: Oid xidArray :: Oid xml :: Oid xmlArray :: Oid instance GHC.Num.Num Database.PostgreSQL.Pure.Oid.Oid instance GHC.Classes.Eq Database.PostgreSQL.Pure.Oid.Oid instance GHC.Show.Show Database.PostgreSQL.Pure.Oid.Oid instance GHC.Read.Read Database.PostgreSQL.Pure.Oid.Oid module Database.PostgreSQL.Pure.Parser -- | For implementing fromRecord. column :: FromField a => StringDecoder -> ColumnInfo -> Parser a -- | This is a list interface version of Database.PostgreSQL.Pure. -- --

Typical Example

-- -- Prepare a following table. -- --
--   CREATE TABLE person (
--     id serial PRIMARY KEY,
--     name varchar(255) NOT NULL
--   );
--   INSERT INTO person (name) VALUES ('Ada');
--   
-- -- You can run like following to get the record whose ID is 1. -- --
--   >>> :set -XOverloadedStrings
--   
--   >>> :set -XFlexibleContexts
--   
--   >>> :set -XTypeApplications
--   
--   >>> 
--   
--   >>> import Database.PostgreSQL.Pure.List
--   
--   >>> import Data.Default.Class (def)
--   
--   >>> import Data.Int (Int32)
--   
--   >>> import Data.ByteString (ByteString)
--   
--   >>> import Data.Tuple.Only (Only (Only))
--   
--   >>> import Data.Maybe (fromMaybe)
--   
--   >>> import System.Environment (lookupEnv)
--   
--   >>> 
--   
--   >>> getEnvDef name value = fromMaybe value <$> lookupEnv name
--   
--   >>> 
--   
--   >>> host' <- getEnvDef "PURE_HOST" "127.0.0.1"
--   
--   >>> port' <- getEnvDef "PURE_PORT" "5432"
--   
--   >>> user' <- getEnvDef "PURE_USER" "postgres"
--   
--   >>> password' <- getEnvDef "PURE_PASSWORD" ""
--   
--   >>> database' <- getEnvDef "PURE_DATABASE" "postgres"
--   
--   >>> 
--   
--   >>> conn <- connect def { address = AddressNotResolved host' port', user = user', password = password', database = database' }
--   
--   >>> preparedStatementProcedure = parse "" "SELECT id, name FROM person WHERE id = $1" (Left (1, 2))
--   
--   >>> portalProcedure <- bind "" BinaryFormat BinaryFormat (parameters conn) (const $ fail "") (Only (1 :: Int32)) preparedStatementProcedure
--   
--   >>> executedProcedure = execute @_ @(Int32, ByteString) 0 (const $ fail "") portalProcedure
--   
--   >>> ((_, _, e, _), _) <- sync conn executedProcedure
--   
--   >>> records e
--   [(1,"Ada")]
--   
module Database.PostgreSQL.Pure.List -- | A configuration of a connection. -- -- Default configuration is def, which is following. -- --
--   >>> address def
--   AddressResolved 127.0.0.1:5432
--   
--   >>> user def
--   "postgres"
--   
--   >>> password def
--   ""
--   
--   >>> database def
--   ""
--   
--   >>> sendingBufferSize def
--   4096
--   
--   >>> receptionBufferSize def
--   4096
--   
data Config Config :: Address -> String -> String -> String -> Int -> Int -> Config -- | Server address. [$sel:address:Config] :: Config -> Address -- | User name. [$sel:user:Config] :: Config -> String -- | Password of user. [$sel:password:Config] :: Config -> String -- | Database name. [$sel:database:Config] :: Config -> String -- | The size of sending buffer in byte. [$sel:sendingBufferSize:Config] :: Config -> Int -- | The size of receiving buffer in byte. [$sel:receptionBufferSize:Config] :: Config -> Int -- | PostgreSQL connection. data Connection -- | The process ID of the server. ($sel:pid:Connection) :: Connection -> Pid -- | Set of server parameters. ($sel:parameters:Connection) :: Connection -> BackendParameters -- | Configuration of this connection. ($sel:config:Connection) :: Connection -> Config -- | IP address. data Address -- | Address which is DNS resolved. AddressResolved :: SockAddr -> Address -- | Address which is not DNS resolved. AddressNotResolved :: HostName -> ServiceName -> Address -- | Set of server parameters. type BackendParameters = Map ShortByteString ShortByteString -- | Process ID type Pid = Int32 -- | Bracket function for a connection. withConnection :: Config -> (Connection -> IO a) -> IO a -- | To connect to the server. connect :: Config -> IO Connection -- | To disconnect to the server. disconnect :: Connection -> IO () -- | To get the procedure to build the message of parsing SQL query and to -- parse its response. parse :: PreparedStatementName -> Query -> Either (Word, Word) ([Oid], [Oid]) -> PreparedStatementProcedure -- | To get the procedure to build the message of binding the parameter and -- to parse its response. bind :: (Bind ps, ToRecord param, MonadFail m) => PortalName -> FormatCode -> FormatCode -> BackendParameters -> StringEncoder -> param -> ps -> m PortalProcedure -- | To get the procedure to build the message of execution and to parse -- its response. execute :: (Execute p, FromRecord result) => Word -> StringDecoder -> p -> ExecutedProcedure result -- | To build and send the given message and a “Flush” message and to -- receive and parse those responses. flush :: Message m => Connection -> m -> IO (MessageResult m) -- | To build and send the given message and a “Sync” message and to -- receive and parse those responses. sync :: Message m => Connection -> m -> IO (MessageResult m, TransactionState) -- | To build and send the “Close” message and to receive and parse its -- response. close :: Close p => p -> CloseProcedure -- | This represents a prepared statement which is already processed by a -- server. data PreparedStatement -- | This represents a prepared statement which is not yet processed by a -- server. data PreparedStatementProcedure -- | Name of a prepared statement. newtype PreparedStatementName PreparedStatementName :: ByteString -> PreparedStatementName -- | This represents a portal which is already processed by a server. data Portal -- | This represents a portal which is not yet processed by a server. data PortalProcedure -- | Name of a portal. newtype PortalName PortalName :: ByteString -> PortalName -- | This represents a result of a “Execute” message which is already -- processed by a server. data Executed r -- | This represents a result of a “Execute” message which is not yet -- processed by a server. data ExecutedProcedure r -- | Result of a “Execute” message. data ExecuteResult -- | All records gotten. ExecuteComplete :: CommandTag -> ExecuteResult -- | No records. ExecuteEmptyQuery :: ExecuteResult -- | Records are left yet. ExecuteSuspended :: ExecuteResult -- | Command tag, which means which SQL command is completed. data CommandTag InsertTag :: Oid -> Int -> CommandTag DeleteTag :: Int -> CommandTag UpdateTag :: Int -> CommandTag SelectTag :: Int -> CommandTag MoveTag :: Int -> CommandTag FetchTag :: Int -> CommandTag CopyTag :: Int -> CommandTag CreateTableTag :: CommandTag DropTableTag :: CommandTag BeginTag :: CommandTag CommitTag :: CommandTag RollbackTag :: CommandTag SetTag :: CommandTag -- | SQL query. -- -- This fromString counts only ASCII, because it is the same with -- ByteString. newtype Query Query :: ByteString -> Query -- | Format code of parameters of results. data FormatCode TextFormat :: FormatCode BinaryFormat :: FormatCode -- | Metadata of a column. data ColumnInfo -- | This means that r is a objective of flush and -- sync. class Message m -- | To convert a type which means that it is not processed by the server -- to a respective type which means that it is processed by the server. type family MessageResult m :: Type -- | This means that ps is a objective of bind. class Bind ps -- | This means that p is a objective of execute. class Execute p -- | This means that p is a objective of close. class Close p -- | Encoder of strings which may fail. type StringEncoder = String -> Either String ByteString -- | Decoder of strings which may fail. type StringDecoder = ByteString -> Either String String -- | To send BEGIN SQL statement. begin :: ExecutedProcedure () -- | To send COMMIT SQL statement. commit :: ExecutedProcedure () -- | To send ROLLBACK SQL statement. rollback :: ExecutedProcedure () -- | Transaction state of a server. data TransactionState -- | Not in a transaction block. Idle :: TransactionState -- | In a transaction block. Block :: TransactionState -- | Transaction failed. Failed :: TransactionState -- | This means that a field can be decoded as a. class FromField a -- | Decoder of a field. fromField :: (FromField a, MonadFail m) => StringDecoder -> ColumnInfo -> Maybe ByteString -> m a -- | This means that a record can be parsed as a. class FromRecord a -- | Decoder of a record. fromRecord :: FromRecord a => StringDecoder -> [ColumnInfo] -> Parser a -- | Decoder of a record. fromRecord :: (FromRecord a, Generic a, GFromRecord (Rep a)) => StringDecoder -> [ColumnInfo] -> Parser a -- | This means that a can be encoded to a field. class ToField a -- | Encoder of a field. toField :: (ToField a, MonadFail m) => BackendParameters -> StringEncoder -> Maybe Oid -> FormatCode -> a -> m (Maybe ByteString) -- | This means that a can be encoded to a record. class ToRecord a -- | Encoder of a field. toRecord :: (ToRecord a, MonadFail m) => BackendParameters -> StringEncoder -> Maybe [Oid] -> [FormatCode] -> a -> m [Maybe ByteString] -- | Encoder of a field. toRecord :: (ToRecord a, MonadFail m, Generic a, GToRecord (Rep a)) => BackendParameters -> StringEncoder -> Maybe [Oid] -> [FormatCode] -> a -> m [Maybe ByteString] -- | Data without encoding nor decoding of a field. data Raw -- | Not NULL. pattern Value :: ByteString -> Raw -- | NULL. pattern Null :: Raw -- | Type of PostgreSQL sql_identifier type. newtype SqlIdentifier SqlIdentifier :: ByteString -> SqlIdentifier data TimeOfDayWithTimeZone TimeOfDayWithTimeZone :: TimeOfDay -> TimeZone -> TimeOfDayWithTimeZone [$sel:timeOfDay:TimeOfDayWithTimeZone] :: TimeOfDayWithTimeZone -> TimeOfDay [$sel:timeZone:TimeOfDayWithTimeZone] :: TimeOfDayWithTimeZone -> TimeZone -- | Root exception. -- --
--   Exception
--     ├ ErrorResponse
--     └ ResponseParsingFailed
--   
data Exception Exception :: e -> Exception -- | This means that the server responds an error. data ErrorResponse ErrorResponse :: ByteString -> ByteString -> ByteString -> Maybe TransactionState -> ErrorResponse [severity] :: ErrorResponse -> ByteString [code] :: ErrorResponse -> ByteString [message] :: ErrorResponse -> ByteString [transactionState] :: ErrorResponse -> Maybe TransactionState -- | This means that the server responds an unknown message. newtype ResponseParsingFailed ResponseParsingFailed :: String -> ResponseParsingFailed [causedBy] :: ResponseParsingFailed -> String -- | OID. -- -- Constant values are listed in Database.PostgreSQL.Pure.Oid. data Oid -- | This is a client library for PostgreSQL Database which has following -- features. -- -- -- --

Typical Example

-- -- Prepare a following table. -- --
--   CREATE TABLE person (
--     id serial PRIMARY KEY,
--     name varchar(255) NOT NULL
--   );
--   INSERT INTO person (name) VALUES ('Ada');
--   
-- -- You can run like following to get the record whose ID is 1. -- --
--   >>> :set -XOverloadedStrings
--   
--   >>> :set -XFlexibleContexts
--   
--   >>> :set -XDataKinds
--   
--   >>> :set -XTypeFamilies
--   
--   >>> :set -XTypeApplications
--   
--   >>> 
--   
--   >>> import Database.PostgreSQL.Pure
--   
--   >>> import Data.Default.Class (def)
--   
--   >>> import Data.Int (Int32)
--   
--   >>> import Data.ByteString (ByteString)
--   
--   >>> import Data.Tuple.Only (Only (Only))
--   
--   >>> import Data.Tuple.Homotuple.Only ()
--   
--   >>> import Data.Maybe (fromMaybe)
--   
--   >>> import System.Environment (lookupEnv)
--   
--   >>> 
--   
--   >>> getEnvDef name value = fromMaybe value <$> lookupEnv name
--   
--   >>> 
--   
--   >>> host' <- getEnvDef "PURE_HOST" "127.0.0.1"
--   
--   >>> port' <- getEnvDef "PURE_PORT" "5432"
--   
--   >>> user' <- getEnvDef "PURE_USER" "postgres"
--   
--   >>> password' <- getEnvDef "PURE_PASSWORD" ""
--   
--   >>> database' <- getEnvDef "PURE_DATABASE" "postgres"
--   
--   >>> 
--   
--   >>> conn <- connect def { address = AddressNotResolved host' port', user = user', password = password', database = database' }
--   
--   >>> preparedStatementProcedure = parse "" "SELECT id, name FROM person WHERE id = $1" Nothing
--   
--   >>> portalProcedure <- bind @_ @2 @_ @_ "" BinaryFormat BinaryFormat (parameters conn) (const $ fail "") (Only (1 :: Int32)) preparedStatementProcedure
--   
--   >>> executedProcedure = execute @_ @_ @(Int32, ByteString) 0 (const $ fail "") portalProcedure
--   
--   >>> ((_, _, e, _), _) <- sync conn executedProcedure
--   
--   >>> records e
--   [(1,"Ada")]
--   
module Database.PostgreSQL.Pure -- | A configuration of a connection. -- -- Default configuration is def, which is following. -- --
--   >>> address def
--   AddressResolved 127.0.0.1:5432
--   
--   >>> user def
--   "postgres"
--   
--   >>> password def
--   ""
--   
--   >>> database def
--   ""
--   
--   >>> sendingBufferSize def
--   4096
--   
--   >>> receptionBufferSize def
--   4096
--   
data Config Config :: Address -> String -> String -> String -> Int -> Int -> Config -- | Server address. [$sel:address:Config] :: Config -> Address -- | User name. [$sel:user:Config] :: Config -> String -- | Password of user. [$sel:password:Config] :: Config -> String -- | Database name. [$sel:database:Config] :: Config -> String -- | The size of sending buffer in byte. [$sel:sendingBufferSize:Config] :: Config -> Int -- | The size of receiving buffer in byte. [$sel:receptionBufferSize:Config] :: Config -> Int -- | PostgreSQL connection. data Connection -- | The process ID of the server. ($sel:pid:Connection) :: Connection -> Pid -- | Set of server parameters. ($sel:parameters:Connection) :: Connection -> BackendParameters -- | Configuration of this connection. ($sel:config:Connection) :: Connection -> Config -- | IP address. data Address -- | Address which is DNS resolved. AddressResolved :: SockAddr -> Address -- | Address which is not DNS resolved. AddressNotResolved :: HostName -> ServiceName -> Address -- | Set of server parameters. type BackendParameters = Map ShortByteString ShortByteString -- | Process ID type Pid = Int32 -- | Bracket function for a connection. withConnection :: Config -> (Connection -> IO a) -> IO a -- | To connect to the server. connect :: Config -> IO Connection -- | To disconnect to the server. disconnect :: Connection -> IO () -- | To get the procedure to build the message of parsing SQL query and to -- parse its response. parse :: forall plen rlen. (KnownNat plen, KnownNat rlen, Item (Homotuple plen Oid) ~ Oid, Item (Homotuple rlen ColumnInfo) ~ ColumnInfo, Item (Homotuple rlen Oid) ~ Oid, IsList (Homotuple rlen Oid), IsList (Homotuple plen Oid), IsList (Homotuple rlen ColumnInfo)) => PreparedStatementName -> Query -> Maybe (Homotuple plen Oid, Homotuple rlen Oid) -> PreparedStatementProcedure plen rlen -- | To get the procedure to build the message of binding the parameter and -- to parse its response. bind :: forall rlen param m. (Bind ps, ToRecord param, KnownNat rlen, HasLength (Homotuple rlen ColumnInfo), MonadFail m) => PortalName -> FormatCode -> FormatCode -> BackendParameters -> StringEncoder -> param -> ps (Length param) rlen -> m (PortalProcedure (Length param) rlen) -- | To get the procedure to build the message of execution and to parse -- its response. execute :: forall plen result. (Execute p, FromRecord result, ColumnInfo ~ Item (Homotuple (Length result) ColumnInfo), IsList (Homotuple (Length result) ColumnInfo)) => Word -> StringDecoder -> p plen (Length result) -> ExecutedProcedure plen (Length result) result -- | To build and send the given message and a “Flush” message and to -- receive and parse those responses. flush :: Message m => Connection -> m -> IO (MessageResult m) -- | To build and send the given message and a “Sync” message and to -- receive and parse those responses. sync :: Message m => Connection -> m -> IO (MessageResult m, TransactionState) -- | To build and send the “Close” message and to receive and parse its -- response. close :: Close p => p -> CloseProcedure -- | This represents a prepared statement which is already processed by a -- server. -- -- parameterLength is the number of columns of the parameter and -- resultLength is the number of columns of the results. This is -- the same with PreparedStatementProcedure, Portal, -- PortalProcedure, Executed and ExecutedProcedure. data PreparedStatement (parameterLength :: Nat) (resultLength :: Nat) -- | This represents a prepared statement which is not yet processed by a -- server. data PreparedStatementProcedure (parameterLength :: Nat) (resultLength :: Nat) -- | Name of a prepared statement. newtype PreparedStatementName PreparedStatementName :: ByteString -> PreparedStatementName -- | This represents a portal which is already processed by a server. data Portal (parameterLength :: Nat) (resultLength :: Nat) -- | This represents a portal which is not yet processed by a server. data PortalProcedure (parameterLength :: Nat) (resultLength :: Nat) -- | Name of a portal. newtype PortalName PortalName :: ByteString -> PortalName -- | This represents a result of a Execute message which is already -- processed by a server. data Executed (parameterLength :: Nat) (resultLength :: Nat) r -- | This represents a result of a Execute message which is not yet -- processed by a server. data ExecutedProcedure (parameterLength :: Nat) (resultLength :: Nat) r -- | Result of a “Execute” message. data ExecuteResult -- | All records gotten. ExecuteComplete :: CommandTag -> ExecuteResult -- | No records. ExecuteEmptyQuery :: ExecuteResult -- | Records are left yet. ExecuteSuspended :: ExecuteResult -- | This represents a result of a “Close” message which is not yet -- processed by a server. data CloseProcedure -- | Command tag, which means which SQL command is completed. data CommandTag InsertTag :: Oid -> Int -> CommandTag DeleteTag :: Int -> CommandTag UpdateTag :: Int -> CommandTag SelectTag :: Int -> CommandTag MoveTag :: Int -> CommandTag FetchTag :: Int -> CommandTag CopyTag :: Int -> CommandTag CreateTableTag :: CommandTag DropTableTag :: CommandTag BeginTag :: CommandTag CommitTag :: CommandTag RollbackTag :: CommandTag SetTag :: CommandTag -- | SQL query. -- -- This fromString counts only ASCII, because it is the same with -- ByteString. newtype Query Query :: ByteString -> Query -- | Format code of parameters of results. data FormatCode TextFormat :: FormatCode BinaryFormat :: FormatCode -- | Metadata of a column. data ColumnInfo -- | This means that r is a objective of flush and -- sync. class Message m -- | To convert a type which means that it is not processed by the server -- to a respective type which means that it is processed by the server. type family MessageResult m :: Type -- | This means that ps is a objective of bind. class Bind ps -- | This means that p is a objective of execute. class Execute p -- | This means that p is a objective of close. class Close p -- | Encoder of strings which may fail. type StringEncoder = String -> Either String ByteString -- | Decoder of strings which may fail. type StringDecoder = ByteString -> Either String String -- | This means that r has a name accessor. class HasName r -- | Type of name of r. type family Name r :: Type -- | This means that r has a parameterOids accessor. class HasParameterOids r a -- | To get a name of r. name :: HasName r => r -> Name r -- | To get OIDs of a parameter. parameterOids :: HasParameterOids r a => r -> a -- | To get a list of column infos of the result record. resultInfos :: (IsList (Homotuple m ColumnInfo), ColumnInfo ~ Item (Homotuple m ColumnInfo)) => PreparedStatement n m -> Homotuple m ColumnInfo -- | To get the result of Executed. result :: Executed n m r -> ExecuteResult -- | To get the records of Executed. records :: Executed n m r -> [r] -- | To send BEGIN SQL statement. begin :: ExecutedProcedure 0 0 () -- | To send COMMIT SQL statement. commit :: ExecutedProcedure 0 0 () -- | To send ROLLBACK SQL statement. rollback :: ExecutedProcedure 0 0 () -- | Transaction state of a server. data TransactionState -- | Not in a transaction block. Idle :: TransactionState -- | In a transaction block. Block :: TransactionState -- | Transaction failed. Failed :: TransactionState -- | This means that a field can be decoded as a. class FromField a -- | Decoder of a field. fromField :: (FromField a, MonadFail m) => StringDecoder -> ColumnInfo -> Maybe ByteString -> m a -- | This means that a record can be parsed as a. class FromRecord a -- | Decoder of a record. fromRecord :: FromRecord a => StringDecoder -> [ColumnInfo] -> Parser a -- | Decoder of a record. fromRecord :: (FromRecord a, Generic a, GFromRecord (Rep a)) => StringDecoder -> [ColumnInfo] -> Parser a -- | This means that a can be encoded to a field. class ToField a -- | Encoder of a field. toField :: (ToField a, MonadFail m) => BackendParameters -> StringEncoder -> Maybe Oid -> FormatCode -> a -> m (Maybe ByteString) -- | This means that a can be encoded to a record. class ToRecord a -- | Encoder of a field. toRecord :: (ToRecord a, MonadFail m) => BackendParameters -> StringEncoder -> Maybe [Oid] -> [FormatCode] -> a -> m [Maybe ByteString] -- | Encoder of a field. toRecord :: (ToRecord a, MonadFail m, Generic a, GToRecord (Rep a)) => BackendParameters -> StringEncoder -> Maybe [Oid] -> [FormatCode] -> a -> m [Maybe ByteString] -- | Data without encoding nor decoding of a field. data Raw -- | Not NULL. pattern Value :: ByteString -> Raw -- | NULL. pattern Null :: Raw -- | Type of PostgreSQL sql_identifier type. newtype SqlIdentifier SqlIdentifier :: ByteString -> SqlIdentifier data TimeOfDayWithTimeZone TimeOfDayWithTimeZone :: TimeOfDay -> TimeZone -> TimeOfDayWithTimeZone [$sel:timeOfDay:TimeOfDayWithTimeZone] :: TimeOfDayWithTimeZone -> TimeOfDay [$sel:timeZone:TimeOfDayWithTimeZone] :: TimeOfDayWithTimeZone -> TimeZone -- | The number of columns. type family Length a :: Nat -- | Root exception. -- --
--   Exception
--     ├ ErrorResponse
--     └ ResponseParsingFailed
--   
data Exception Exception :: e -> Exception -- | This means that the server responds an error. data ErrorResponse ErrorResponse :: ByteString -> ByteString -> ByteString -> Maybe TransactionState -> ErrorResponse [severity] :: ErrorResponse -> ByteString [code] :: ErrorResponse -> ByteString [message] :: ErrorResponse -> ByteString [transactionState] :: ErrorResponse -> Maybe TransactionState -- | This means that the server responds an unknown message. newtype ResponseParsingFailed ResponseParsingFailed :: String -> ResponseParsingFailed [causedBy] :: ResponseParsingFailed -> String -- | OID. -- -- Constant values are listed in Database.PostgreSQL.Pure.Oid. data Oid instance Database.PostgreSQL.Pure.Internal.Query.Close (Database.PostgreSQL.Pure.PreparedStatement parameterLength resultLength) instance GHC.Classes.Eq (Database.PostgreSQL.Pure.PreparedStatement parameterLength resultLength) instance GHC.Show.Show (Database.PostgreSQL.Pure.PreparedStatement parameterLength resultLength) instance Database.PostgreSQL.Pure.Internal.Query.Message (Database.PostgreSQL.Pure.PreparedStatementProcedure parameterLength resultLength) instance GHC.Show.Show (Database.PostgreSQL.Pure.PreparedStatementProcedure parameterLength resultLength) instance Database.PostgreSQL.Pure.Internal.Query.Close (Database.PostgreSQL.Pure.Portal parameterLength resultLength) instance GHC.Classes.Eq (Database.PostgreSQL.Pure.Portal parameterLength resultLength) instance GHC.Show.Show (Database.PostgreSQL.Pure.Portal parameterLength resultLength) instance Database.PostgreSQL.Pure.Internal.Query.Message (Database.PostgreSQL.Pure.PortalProcedure parameterLength resultLength) instance GHC.Show.Show (Database.PostgreSQL.Pure.PortalProcedure parameterLength resultLength) instance GHC.Classes.Eq r => GHC.Classes.Eq (Database.PostgreSQL.Pure.Executed parameterLength resultLength r) instance GHC.Show.Show r => GHC.Show.Show (Database.PostgreSQL.Pure.Executed parameterLength resultLength r) instance Database.PostgreSQL.Pure.Internal.Query.Message (Database.PostgreSQL.Pure.ExecutedProcedure parameterLength resultLength r) instance GHC.Show.Show (Database.PostgreSQL.Pure.ExecutedProcedure parameterLength resultLength r) instance Database.PostgreSQL.Pure.Execute Database.PostgreSQL.Pure.Portal instance Database.PostgreSQL.Pure.Execute Database.PostgreSQL.Pure.PortalProcedure instance Database.PostgreSQL.Pure.Bind Database.PostgreSQL.Pure.PreparedStatement instance Database.PostgreSQL.Pure.Bind Database.PostgreSQL.Pure.PreparedStatementProcedure instance (oids GHC.Types.~ Data.Tuple.Homotuple.Homotuple n Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.Item oids GHC.Types.~ Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.IsList oids) => Database.PostgreSQL.Pure.HasParameterOids (Database.PostgreSQL.Pure.PreparedStatement n m) oids instance (oids GHC.Types.~ Data.Tuple.Homotuple.Homotuple n Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.Item oids GHC.Types.~ Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.IsList oids) => Database.PostgreSQL.Pure.HasParameterOids (Database.PostgreSQL.Pure.PreparedStatementProcedure n m) (GHC.Maybe.Maybe oids) instance Database.PostgreSQL.Pure.HasName (Database.PostgreSQL.Pure.PreparedStatement n m) instance Database.PostgreSQL.Pure.HasName (Database.PostgreSQL.Pure.PreparedStatementProcedure n m) instance Database.PostgreSQL.Pure.HasName (Database.PostgreSQL.Pure.Portal n m) instance Database.PostgreSQL.Pure.HasName (Database.PostgreSQL.Pure.PortalProcedure n m) instance GHC.Records.HasField "name" (Database.PostgreSQL.Pure.PortalProcedure n m) Database.PostgreSQL.Pure.Internal.Data.PortalName instance GHC.Records.HasField "name" (Database.PostgreSQL.Pure.Portal n m) Database.PostgreSQL.Pure.Internal.Data.PortalName instance GHC.Records.HasField "name" (Database.PostgreSQL.Pure.PreparedStatementProcedure n m) Database.PostgreSQL.Pure.Internal.Data.PreparedStatementName instance (oids GHC.Types.~ Data.Tuple.Homotuple.Homotuple n Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.Item oids GHC.Types.~ Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.IsList oids) => GHC.Records.HasField "parameterOids" (Database.PostgreSQL.Pure.PreparedStatementProcedure n m) (GHC.Maybe.Maybe oids) instance GHC.Records.HasField "name" (Database.PostgreSQL.Pure.PreparedStatement n m) Database.PostgreSQL.Pure.Internal.Data.PreparedStatementName instance (oids GHC.Types.~ Data.Tuple.Homotuple.Homotuple n Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.Item oids GHC.Types.~ Database.PostgreSQL.Pure.Oid.Oid, GHC.Exts.IsList oids) => GHC.Records.HasField "parameterOids" (Database.PostgreSQL.Pure.PreparedStatement n m) oids -- | This is a compatible interface with HDBC-postgresql's -- Database.HDBC.PostgreSQL except Config. -- -- Prepared statements are closed when some requests come once -- Statements are GCed, because HDBC doesn't have "close" -- interface. module Database.HDBC.PostgreSQL.Pure -- | A configuration of a connection. -- -- Default configuration is def, which is following. -- --
--   >>> address def
--   AddressResolved 127.0.0.1:5432
--   
--   >>> user def
--   "postgres"
--   
--   >>> password def
--   ""
--   
--   >>> database def
--   ""
--   
--   >>> sendingBufferSize def
--   4096
--   
--   >>> receptionBufferSize def
--   4096
--   
-- --
--   encodeString def = \code -> case code of "UTF8" -> pure . fromString; _ -> const $ fail $ "unexpected character code: " <> show code
--   decodeString def = \code -> case code of "UTF8" -> pure . toString; _ -> const $ fail $ "unexpected character code: " <> show code
--   
data Config Config :: Address -> String -> String -> String -> Int -> Int -> (ShortByteString -> StringEncoder) -> (ShortByteString -> StringDecoder) -> Config [$sel:address:Config] :: Config -> Address [$sel:user:Config] :: Config -> String [$sel:password:Config] :: Config -> String [$sel:database:Config] :: Config -> String -- | in byte [$sel:sendingBufferSize:Config] :: Config -> Int -- | in byte [$sel:receptionBufferSize:Config] :: Config -> Int [$sel:encodeString:Config] :: Config -> ShortByteString -> StringEncoder [$sel:decodeString:Config] :: Config -> ShortByteString -> StringDecoder -- | PostgreSQL connection. data Connection -- | IP address. data Address -- | Address which is DNS resolved. AddressResolved :: SockAddr -> Address -- | Address which is not DNS resolved. AddressNotResolved :: HostName -> ServiceName -> Address -- | Bracket function for a connection. withConnection :: Config -> (Connection -> IO a) -> IO a -- | To connect to the server. connect :: Config -> IO Connection -- | To send BEGIN SQL statement. begin :: Connection -> IO () instance GHC.Classes.Eq Database.HDBC.PostgreSQL.Pure.RequestBuildingFailed instance GHC.Read.Read Database.HDBC.PostgreSQL.Pure.RequestBuildingFailed instance GHC.Show.Show Database.HDBC.PostgreSQL.Pure.RequestBuildingFailed instance Database.HDBC.Types.IConnection Database.HDBC.PostgreSQL.Pure.Connection instance GHC.Exception.Type.Exception Database.HDBC.PostgreSQL.Pure.RequestBuildingFailed instance GHC.Show.Show Database.HDBC.PostgreSQL.Pure.Config instance Data.Default.Class.Default Database.HDBC.PostgreSQL.Pure.Config instance Database.PostgreSQL.Pure.Internal.Data.FromField Database.HDBC.SqlValue.SqlValue instance Database.PostgreSQL.Pure.Internal.Data.ToField Database.HDBC.SqlValue.SqlValue instance Database.PostgreSQL.Pure.Internal.Data.ToField GHC.Real.Rational instance Data.Convertible.Base.Convertible Database.PostgreSQL.Pure.Oid.Oid Database.HDBC.ColTypes.SqlTypeId instance Database.PostgreSQL.Pure.Internal.Data.FromField (Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay, Data.Time.LocalTime.Internal.TimeZone.TimeZone) instance Database.PostgreSQL.Pure.Internal.Data.ToField (Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay, Data.Time.LocalTime.Internal.TimeZone.TimeZone)