{-# LANGUAGE BangPatterns, EmptyDataDecls #-}
module Database.PostgreSQL.LibPQ.Internal where
import Foreign
import Control.Concurrent.MVar ( MVar )
data Connection = Conn {-# UNPACK #-} !(ForeignPtr PGconn)
{-# UNPACK #-} !(MVar NoticeBuffer)
instance Eq Connection where
(Conn c :: ForeignPtr PGconn
c _) == :: Connection -> Connection -> Bool
== (Conn d :: ForeignPtr PGconn
d _) = ForeignPtr PGconn
c ForeignPtr PGconn -> ForeignPtr PGconn -> Bool
forall a. Eq a => a -> a -> Bool
== ForeignPtr PGconn
d
(Conn c :: ForeignPtr PGconn
c _) /= :: Connection -> Connection -> Bool
/= (Conn d :: ForeignPtr PGconn
d _) = ForeignPtr PGconn
c ForeignPtr PGconn -> ForeignPtr PGconn -> Bool
forall a. Eq a => a -> a -> Bool
/= ForeignPtr PGconn
d
withConn :: Connection
-> (Ptr PGconn -> IO b)
-> IO b
withConn :: Connection -> (Ptr PGconn -> IO b) -> IO b
withConn (Conn !ForeignPtr PGconn
fp _) f :: Ptr PGconn -> IO b
f = ForeignPtr PGconn -> (Ptr PGconn -> IO b) -> IO b
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PGconn
fp Ptr PGconn -> IO b
f
{-# INLINE withConn #-}
data PGconn
data CNoticeBuffer
type NoticeBuffer = Ptr CNoticeBuffer