mirror of
https://github.com/postgres-haskell/postgres-wire.git
synced 2024-11-22 05:53:12 +03:00
Decoder for UUID
This commit is contained in:
parent
b286f3cfe5
commit
30c0ad815b
@ -3,6 +3,7 @@ module Database.PostgreSQL.Protocol.Codecs.Decoders where
|
||||
import Data.Word
|
||||
import Data.Int
|
||||
import Data.Char
|
||||
import Data.UUID (UUID, fromWords)
|
||||
import Data.Time (Day, UTCTime, LocalTime, DiffTime)
|
||||
import qualified Data.ByteString as B
|
||||
import qualified Data.Vector as V
|
||||
@ -138,6 +139,14 @@ bsText = getByteString
|
||||
timestamp :: FieldDecoder LocalTime
|
||||
timestamp _ = microsToLocalTime <$> getInt64BE
|
||||
|
||||
{-# INLINE timestamptz #-}
|
||||
timestamptz :: FieldDecoder UTCTime
|
||||
timestamptz _ = microsToUTC <$> getInt64BE
|
||||
|
||||
{-# INLINE uuid #-}
|
||||
uuid :: FieldDecoder UUID
|
||||
uuid _ = fromWords
|
||||
<$> (fromIntegral <$> getInt32BE)
|
||||
<*> (fromIntegral <$> getInt32BE)
|
||||
<*> (fromIntegral <$> getInt32BE)
|
||||
<*> (fromIntegral <$> getInt32BE)
|
||||
|
Loading…
Reference in New Issue
Block a user