Implement FromField Bool

This commit is contained in:
2023-09-05 17:23:25 +02:00
parent 66202b1e34
commit 60f7f1c091
4 changed files with 39 additions and 2 deletions
@@ -85,3 +85,15 @@ instance FromField Double where
fromField = fromParser
(Oid.real \/ Oid.doublePrecision)
floatParser
boolParser :: Parser Bool
boolParser = choice
[ string "t" $> True
, string "f" $> False
]
-- | See https://www.postgresql.org/docs/current/datatype-boolean.html.
instance FromField Bool where
fromField = fromParser
Oid.boolean
boolParser
+4
View File
@@ -39,3 +39,7 @@ real = eq $ Oid 700
-- | 64-bit IEEE float
doublePrecision :: Oid -> Bool
doublePrecision = eq $ Oid 701
-- | Boolean
boolean :: Oid -> Bool
boolean = eq $ Oid 16