@@ -9,6 +9,7 @@ import Data.JSDate as JSDate
99import Data.Maybe (Maybe(..))
1010import Data.Newtype (class Newtype)
1111import Data.Nullable (toNullable)
12+import Data.UUID (UUID)
1213import JS.BigInt (BigInt)
1314import Unsafe.Coerce (unsafeCoerce)
1415import Data.Reflectable (class Reflectable, reflectType)
@@ -82,20 +83,20 @@ instance ReadForeign Jsonb where
8283 readImpl = pure <<< Jsonb
8384
8485-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85−-- UUID type for Postgres
86+-- PGUUID: newtype over Data.UUID.UUID for Postgres integration
8687-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8788
88−newtype UUID = UUID String
89+newtype PGUUID = PGUUID UUID
8990
90−derive instance Newtype UUID _
91−derive newtype instance Eq UUID
92−derive newtype instance Ord UUID
93−derive newtype instance Show UUID
91+derive instance Newtype PGUUID _
92+derive newtype instance Eq PGUUID
93+derive newtype instance Ord PGUUID
94+derive newtype instance Show PGUUID
9495
95−instance ReadForeign UUID where
96+instance ReadForeign PGUUID where
9697 readImpl f = do
9798 s :: String <- readImpl f
98− pure (UUID s)
99+ pure (unsafeCoerce s)
99100
100101-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
101102-- Nullability: inferred from Maybe
@@ -150,7 +151,7 @@ instance PGTypeName DateTime where
150151instance PGTypeName BigInt where
151152 pgTypeName _ = "BIGINT"
152153
153−instance PGTypeName UUID where
154+instance PGTypeName PGUUID where
154155 pgTypeName _ = "UUID"
155156
156157instance PGTypeName Jsonb where