{-# LINE 1 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
-- | Mappings of types used by libpq/libpqtypes to Haskell ADTs.
module Database.PostgreSQL.PQTypes.Internal.C.Types (
    PGcancel
  , PGconn
  , PGparam
  , PGresult
  , PGtypeArgs
  , ConnStatusType(..)
  , c_CONNECTION_OK, c_CONNECTION_BAD, c_CONNECTION_STARTED
  , c_CONNECTION_MADE, c_CONNECTION_AWAITING_RESPONSE, c_CONNECTION_AUTH_OK
  , c_CONNECTION_SETENV, c_CONNECTION_SSL_STARTUP, c_CONNECTION_NEEDED
  , PostgresPollingStatusType(..)
  , c_PGRES_POLLING_FAILED, c_PGRES_POLLING_READING, c_PGRES_POLLING_WRITING
  , c_PGRES_POLLING_OK, c_PGRES_POLLING_ACTIVE
  , ResultFormat(..)
  , c_RESULT_TEXT, c_RESULT_BINARY
  , ExecStatusType(..)
  , c_PGRES_EMPTY_QUERY, c_PGRES_COMMAND_OK, c_PGRES_TUPLES_OK
  , c_PGRES_COPY_OUT, c_PGRES_COPY_IN, c_PGRES_BAD_RESPONSE
  , c_PGRES_NONFATAL_ERROR, c_PGRES_FATAL_ERROR, c_PGRES_COPY_BOTH
  , ErrorField(..)
  , c_PG_DIAG_SEVERITY, c_PG_DIAG_SQLSTATE, c_PG_DIAG_MESSAGE_PRIMARY
  , c_PG_DIAG_MESSAGE_DETAIL, c_PG_DIAG_MESSAGE_HINT
  , c_PG_DIAG_STATEMENT_POSITION, c_PG_DIAG_INTERNAL_POSITION
  , c_PG_DIAG_INTERNAL_QUERY, c_PG_DIAG_CONTEXT, c_PG_DIAG_SOURCE_FILE
  , c_PG_DIAG_SOURCE_LINE, c_PG_DIAG_SOURCE_FUNCTION
  , TypeClass(..)
  , c_PQT_SUBCLASS, c_PQT_COMPOSITE, c_PQT_USERDEFINED
  , PGerror(..)
  , PGregisterType(..)
  , PGarray(..)
  , PGbytea(..)
  , PGdate(..)
  , PGtime(..)
  , PGtimestamp(..)
  ) where

import Data.ByteString.Unsafe
import Foreign.C
import Foreign.ForeignPtr
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import qualified Data.ByteString as BS
import qualified Data.Vector.Storable as V

data PGcancel
data PGconn
data PGparam
data PGresult
data PGtypeArgs




----------------------------------------

newtype ConnStatusType = ConnStatusType CInt
  deriving Eq

c_CONNECTION_OK  :: ConnStatusType
c_CONNECTION_OK  = ConnStatusType 0
c_CONNECTION_BAD  :: ConnStatusType
c_CONNECTION_BAD  = ConnStatusType 1
c_CONNECTION_STARTED  :: ConnStatusType
c_CONNECTION_STARTED  = ConnStatusType 2
c_CONNECTION_MADE  :: ConnStatusType
c_CONNECTION_MADE  = ConnStatusType 3
c_CONNECTION_AWAITING_RESPONSE  :: ConnStatusType
c_CONNECTION_AWAITING_RESPONSE  = ConnStatusType 4
c_CONNECTION_AUTH_OK  :: ConnStatusType
c_CONNECTION_AUTH_OK  = ConnStatusType 5
c_CONNECTION_SETENV  :: ConnStatusType
c_CONNECTION_SETENV  = ConnStatusType 6
c_CONNECTION_SSL_STARTUP  :: ConnStatusType
c_CONNECTION_SSL_STARTUP  = ConnStatusType 7
c_CONNECTION_NEEDED  :: ConnStatusType
c_CONNECTION_NEEDED  = ConnStatusType 8

{-# LINE 72 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

newtype PostgresPollingStatusType = PostgresPollingStatusType CInt
  deriving Eq

c_PGRES_POLLING_FAILED   :: PostgresPollingStatusType
c_PGRES_POLLING_FAILED   = PostgresPollingStatusType 0
c_PGRES_POLLING_READING  :: PostgresPollingStatusType
c_PGRES_POLLING_READING  = PostgresPollingStatusType 1
c_PGRES_POLLING_WRITING  :: PostgresPollingStatusType
c_PGRES_POLLING_WRITING  = PostgresPollingStatusType 2
c_PGRES_POLLING_OK       :: PostgresPollingStatusType
c_PGRES_POLLING_OK       = PostgresPollingStatusType 3
c_PGRES_POLLING_ACTIVE   :: PostgresPollingStatusType
c_PGRES_POLLING_ACTIVE   = PostgresPollingStatusType 4

{-# LINE 85 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

newtype ResultFormat = ResultFormat CInt

c_RESULT_TEXT :: ResultFormat
c_RESULT_TEXT = ResultFormat 0

c_RESULT_BINARY :: ResultFormat
c_RESULT_BINARY = ResultFormat 1

----------------------------------------

newtype ExecStatusType = ExecStatusType CInt
  deriving Eq

c_PGRES_EMPTY_QUERY  :: ExecStatusType
c_PGRES_EMPTY_QUERY  = ExecStatusType 0
c_PGRES_COMMAND_OK  :: ExecStatusType
c_PGRES_COMMAND_OK  = ExecStatusType 1
c_PGRES_TUPLES_OK  :: ExecStatusType
c_PGRES_TUPLES_OK  = ExecStatusType 2
c_PGRES_COPY_OUT  :: ExecStatusType
c_PGRES_COPY_OUT  = ExecStatusType 3
c_PGRES_COPY_IN  :: ExecStatusType
c_PGRES_COPY_IN  = ExecStatusType 4
c_PGRES_BAD_RESPONSE  :: ExecStatusType
c_PGRES_BAD_RESPONSE  = ExecStatusType 5
c_PGRES_NONFATAL_ERROR  :: ExecStatusType
c_PGRES_NONFATAL_ERROR  = ExecStatusType 6
c_PGRES_FATAL_ERROR  :: ExecStatusType
c_PGRES_FATAL_ERROR  = ExecStatusType 7
c_PGRES_COPY_BOTH  :: ExecStatusType
c_PGRES_COPY_BOTH  = ExecStatusType 8

{-# LINE 112 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

newtype ErrorField = ErrorField CInt
  deriving Eq

c_PG_DIAG_SEVERITY  :: ErrorField
c_PG_DIAG_SEVERITY  = ErrorField 83
c_PG_DIAG_SQLSTATE  :: ErrorField
c_PG_DIAG_SQLSTATE  = ErrorField 67
c_PG_DIAG_MESSAGE_PRIMARY  :: ErrorField
c_PG_DIAG_MESSAGE_PRIMARY  = ErrorField 77
c_PG_DIAG_MESSAGE_DETAIL  :: ErrorField
c_PG_DIAG_MESSAGE_DETAIL  = ErrorField 68
c_PG_DIAG_MESSAGE_HINT  :: ErrorField
c_PG_DIAG_MESSAGE_HINT  = ErrorField 72
c_PG_DIAG_STATEMENT_POSITION  :: ErrorField
c_PG_DIAG_STATEMENT_POSITION  = ErrorField 80
c_PG_DIAG_INTERNAL_POSITION  :: ErrorField
c_PG_DIAG_INTERNAL_POSITION  = ErrorField 112
c_PG_DIAG_INTERNAL_QUERY  :: ErrorField
c_PG_DIAG_INTERNAL_QUERY  = ErrorField 113
c_PG_DIAG_CONTEXT  :: ErrorField
c_PG_DIAG_CONTEXT  = ErrorField 87
c_PG_DIAG_SOURCE_FILE  :: ErrorField
c_PG_DIAG_SOURCE_FILE  = ErrorField 70
c_PG_DIAG_SOURCE_LINE  :: ErrorField
c_PG_DIAG_SOURCE_LINE  = ErrorField 76
c_PG_DIAG_SOURCE_FUNCTION  :: ErrorField
c_PG_DIAG_SOURCE_FUNCTION  = ErrorField 82

{-# LINE 132 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

newtype TypeClass = TypeClass CInt
  deriving Eq

c_PQT_SUBCLASS  :: TypeClass
c_PQT_SUBCLASS  = TypeClass 0
c_PQT_COMPOSITE  :: TypeClass
c_PQT_COMPOSITE  = TypeClass 1
c_PQT_USERDEFINED  :: TypeClass
c_PQT_USERDEFINED  = TypeClass 2

{-# LINE 143 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

newtype PGerror = PGerror {
  pgErrorMsg :: String
} deriving Show

instance Storable PGerror where
  sizeOf _ = (2048)
{-# LINE 152 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 1
{-# LINE 153 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGerror <$> peekCString ((\hsc_ptr -> hsc_ptr `plusPtr` 0) ptr)
{-# LINE 154 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke _ _ = error "Storable PGerror: poke is not supposed to be used"

----------------------------------------

data PGregisterType = PGregisterType {
  pgRegisterTypeTypName :: !CString
, pgRegisterTypeTypPut  :: !(FunPtr (Ptr PGtypeArgs -> IO CInt))
, pgRegisterTypeTypGet  :: !(FunPtr (Ptr PGtypeArgs -> IO CInt))
} deriving Show

instance Storable PGregisterType where
  sizeOf _ = (24)
{-# LINE 166 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 167 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGregisterType
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 169 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 170 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 171 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGregisterType{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgRegisterTypeTypName
{-# LINE 173 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr pgRegisterTypeTypPut
{-# LINE 174 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgRegisterTypeTypGet
{-# LINE 175 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

c_MAXDIM :: Int
c_MAXDIM = 6
{-# LINE 180 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

data PGarray = PGarray {
  pgArrayNDims  :: !CInt
, pgArrayLBound :: !(V.Vector CInt)
, pgArrayDims   :: !(V.Vector CInt)
, pgArrayParam  :: !(Ptr PGparam)
, pgArrayRes    :: !(Ptr PGresult)
} deriving Show

instance Storable PGarray where
  sizeOf _ = (72)
{-# LINE 191 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 192 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGarray
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 194 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> readVector ((\hsc_ptr -> hsc_ptr `plusPtr` 4) ptr)
{-# LINE 195 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> readVector ((\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr)
{-# LINE 196 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr
{-# LINE 197 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 64) ptr
{-# LINE 198 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    where
      readVector :: Ptr CInt -> IO (V.Vector CInt)
      readVector src = do
        let len = c_MAXDIM
        fptr <- mallocForeignPtrArray len
        withForeignPtr fptr $ \dest -> copyArray dest src len
        return (V.unsafeFromForeignPtr0 fptr len)

  poke ptr PGarray{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgArrayNDims
{-# LINE 208 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    writeVector pgArrayLBound $ (\hsc_ptr -> hsc_ptr `plusPtr` 4) ptr
{-# LINE 209 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    writeVector pgArrayDims $ (\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr
{-# LINE 210 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 56) ptr pgArrayParam
{-# LINE 211 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 64) ptr pgArrayRes
{-# LINE 212 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    where
      writeVector :: V.Vector CInt -> Ptr CInt -> IO ()
      writeVector v dest = do
        let (fptr, baseLen) = V.unsafeToForeignPtr0 v
        withForeignPtr fptr $ \src -> do
          let len = min baseLen c_MAXDIM
          copyArray dest src len

----------------------------------------

data PGbytea = PGbytea {
  pgByteaLen  :: !CInt
, pgByteaData :: !CString
} deriving Show

instance Storable PGbytea where
  sizeOf _ = (16)
{-# LINE 229 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 230 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGbytea
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 232 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 233 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGbytea{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgByteaLen
{-# LINE 235 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr pgByteaData
{-# LINE 236 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

data PGdate = PGdate {
  pgDateIsBC :: !CInt
, pgDateYear :: !CInt
, pgDateMon  :: !CInt
, pgDateMDay :: !CInt
, pgDateJDay :: !CInt
, pgDateYDay :: !CInt
, pgDateWDay :: !CInt
} deriving Show

instance Storable PGdate where
  sizeOf _ = (28)
{-# LINE 251 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 4
{-# LINE 252 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGdate
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 254 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
{-# LINE 255 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)  ptr
{-# LINE 256 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 257 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 258 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 259 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 260 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGdate{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgDateIsBC
{-# LINE 262 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 4) ptr pgDateYear
{-# LINE 263 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)  ptr pgDateMon
{-# LINE 264 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 12) ptr pgDateMDay
{-# LINE 265 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgDateJDay
{-# LINE 266 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 20) ptr pgDateYDay
{-# LINE 267 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr pgDateWDay
{-# LINE 268 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

----------------------------------------

data PGtime = PGtime {
  pgTimeHour   :: !CInt
, pgTimeMin    :: !CInt
, pgTimeSec    :: !CInt
, pgTimeUSec   :: !CInt
, pgTimeWithTZ :: !CInt
, pgTimeIsDST  :: !CInt
, pgTimeGMTOff :: !CInt
, pgTimeTZAbbr :: !BS.ByteString
} deriving Show

instance Storable PGtime where
  sizeOf _ = (44)
{-# LINE 284 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 4
{-# LINE 285 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGtime
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0)   ptr
{-# LINE 287 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 4)    ptr
{-# LINE 288 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)    ptr
{-# LINE 289 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 12)   ptr
{-# LINE 290 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 291 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 20)  ptr
{-# LINE 292 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 293 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> BS.packCString ((\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr)
{-# LINE 294 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGtime{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0)   ptr pgTimeHour
{-# LINE 296 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 4)    ptr pgTimeMin
{-# LINE 297 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)    ptr pgTimeSec
{-# LINE 298 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 12)   ptr pgTimeUSec
{-# LINE 299 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgTimeWithTZ
{-# LINE 300 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 20)  ptr pgTimeIsDST
{-# LINE 301 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr pgTimeGMTOff
{-# LINE 302 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    unsafeUseAsCStringLen pgTimeTZAbbr $ \(cs, len) -> do
      let tzabbr = (\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr
{-# LINE 304 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
      copyArray tzabbr cs (min len 16)
      pokeElemOff tzabbr (min len 15) (0::CChar)

----------------------------------------

data PGtimestamp = PGtimestamp {
  pgTimestampEpoch :: !CLLong
, pgTimestampDate  :: !PGdate
, pgTimestampTime  :: !PGtime
} deriving Show

instance Storable PGtimestamp where
  sizeOf _ = (80)
{-# LINE 317 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 318 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGtimestamp
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 320 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)  ptr
{-# LINE 321 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 36)  ptr
{-# LINE 322 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGtimestamp{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgTimestampEpoch
{-# LINE 324 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)  ptr pgTimestampDate
{-# LINE 325 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 36)  ptr pgTimestampTime
{-# LINE 326 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}