{-# LINE 1 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
-- | Mappings of types used by libpq/libpqtypes to Haskell ADTs.
{-# LINE 2 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
module Database.PostgreSQL.PQTypes.Internal.C.Types (
    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
  , 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 Control.Applicative
import Data.ByteString.Unsafe
import Foreign.C
import Foreign.ForeignPtr
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import Prelude
import qualified Data.ByteString as BS
import qualified Data.Vector.Storable as V


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

data PGconn
data PGparam
data PGresult
data PGtypeArgs


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

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

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

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 71 "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 98 "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 118 "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 129 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

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

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

instance Storable PGerror where
  sizeOf _ = (2048)
{-# LINE 138 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 1
{-# LINE 139 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGerror <$> peekCString ((\hsc_ptr -> hsc_ptr `plusPtr` 0) ptr)
{-# LINE 140 "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 152 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 153 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGregisterType
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 155 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 156 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 157 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGregisterType{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgRegisterTypeTypName
{-# LINE 159 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr pgRegisterTypeTypPut
{-# LINE 160 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgRegisterTypeTypGet
{-# LINE 161 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}

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

c_MAXDIM :: Int
c_MAXDIM = 6
{-# LINE 166 "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 177 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 178 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGarray
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 180 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> readVector ((\hsc_ptr -> hsc_ptr `plusPtr` 4) ptr)
{-# LINE 181 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> readVector ((\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr)
{-# LINE 182 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr
{-# LINE 183 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 64) ptr
{-# LINE 184 "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 194 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    writeVector pgArrayLBound $ (\hsc_ptr -> hsc_ptr `plusPtr` 4) ptr
{-# LINE 195 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    writeVector pgArrayDims $ (\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr
{-# LINE 196 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 56) ptr pgArrayParam
{-# LINE 197 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 64) ptr pgArrayRes
{-# LINE 198 "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 215 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 216 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGbytea
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 218 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 219 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGbytea{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgByteaLen
{-# LINE 221 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr pgByteaData
{-# LINE 222 "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 237 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 4
{-# LINE 238 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGdate
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 240 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
{-# LINE 241 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)  ptr
{-# LINE 242 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 243 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 244 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 245 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 246 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGdate{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgDateIsBC
{-# LINE 248 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 4) ptr pgDateYear
{-# LINE 249 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)  ptr pgDateMon
{-# LINE 250 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 12) ptr pgDateMDay
{-# LINE 251 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgDateJDay
{-# LINE 252 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 20) ptr pgDateYDay
{-# LINE 253 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr pgDateWDay
{-# LINE 254 "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 270 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 4
{-# LINE 271 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGtime
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0)   ptr
{-# LINE 273 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 4)    ptr
{-# LINE 274 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)    ptr
{-# LINE 275 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 12)   ptr
{-# LINE 276 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 277 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 20)  ptr
{-# LINE 278 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 279 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> BS.packCString ((\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr)
{-# LINE 280 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGtime{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0)   ptr pgTimeHour
{-# LINE 282 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 4)    ptr pgTimeMin
{-# LINE 283 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)    ptr pgTimeSec
{-# LINE 284 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 12)   ptr pgTimeUSec
{-# LINE 285 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr pgTimeWithTZ
{-# LINE 286 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 20)  ptr pgTimeIsDST
{-# LINE 287 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr pgTimeGMTOff
{-# LINE 288 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    unsafeUseAsCStringLen pgTimeTZAbbr $ \(cs, len) -> do
      let tzabbr = (\hsc_ptr -> hsc_ptr `plusPtr` 28) ptr
{-# LINE 290 "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 303 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  alignment _ = 8
{-# LINE 304 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  peek ptr = PGtimestamp
    <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 306 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 8)  ptr
{-# LINE 307 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    <*> (\hsc_ptr -> peekByteOff hsc_ptr 36)  ptr
{-# LINE 308 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
  poke ptr PGtimestamp{..} = do
    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr pgTimestampEpoch
{-# LINE 310 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 8)  ptr pgTimestampDate
{-# LINE 311 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}
    (\hsc_ptr -> pokeByteOff hsc_ptr 36)  ptr pgTimestampTime
{-# LINE 312 "src/Database/PostgreSQL/PQTypes/Internal/C/Types.hsc" #-}