From 726edddffd616114b2ed7a3c1ad71494d5bfb82b Mon Sep 17 00:00:00 2001 From: rightfold Date: Sat, 24 Dec 2016 00:11:23 +0100 Subject: [PATCH] Add "char" to Char mapping --- src/Database/PostgreSQL.purs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Database/PostgreSQL.purs b/src/Database/PostgreSQL.purs index 46bf510..8a36cc5 100644 --- a/src/Database/PostgreSQL.purs +++ b/src/Database/PostgreSQL.purs @@ -23,7 +23,7 @@ import Control.Monad.Aff (Aff) import Control.Monad.Error.Class (catchError, throwError) import Control.Monad.Except (runExcept) import Data.Either (Either(..)) -import Data.Foreign (Foreign, readArray, readString, toForeign) +import Data.Foreign (Foreign, readArray, readChar, readString, toForeign) import Data.List (List) import Data.List as List import Data.Maybe (fromJust, Maybe(..)) @@ -108,6 +108,12 @@ instance fromSQLRowTuple5 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fr fromSQLRow [a, b, c, d, e] = tuple5 <$> fromSQLValue a <*> fromSQLValue b <*> fromSQLValue c <*> fromSQLValue d <*> fromSQLValue e fromSQLRow _ = Nothing +instance toSQLValueChar :: ToSQLValue Char where + toSQLValue = toForeign + +instance fromSQLValueChar :: FromSQLValue Char where + fromSQLValue = fromRight <<< runExcept <<< readChar + instance toSQLValueString :: ToSQLValue String where toSQLValue = toForeign