Implement FromField Bool
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user