From 9609e8c94fccf1bae52498fe36291fec45ac5f22 Mon Sep 17 00:00:00 2001 From: rightfold Date: Thu, 12 Jan 2017 16:52:02 +0100 Subject: [PATCH] Add support for Int --- 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 4c49748..3739d14 100644 --- a/src/Database/PostgreSQL.purs +++ b/src/Database/PostgreSQL.purs @@ -24,7 +24,7 @@ import Control.Monad.Error.Class (catchError, throwError) import Control.Monad.Except (runExcept) import Data.ByteString (ByteString) import Data.Either (Either(..)) -import Data.Foreign (Foreign, readArray, readChar, readString, toForeign, unsafeFromForeign) +import Data.Foreign (Foreign, readArray, readChar, readInt, readString, toForeign, unsafeFromForeign) import Data.List (List) import Data.List as List import Data.Maybe (fromJust, Maybe(..)) @@ -123,6 +123,12 @@ instance toSQLValueChar :: ToSQLValue Char where instance fromSQLValueChar :: FromSQLValue Char where fromSQLValue = fromRight <<< runExcept <<< readChar +instance toSQLValueInt :: ToSQLValue Int where + toSQLValue = toForeign + +instance fromSQLValueInt :: FromSQLValue Int where + fromSQLValue = fromRight <<< runExcept <<< readInt + instance toSQLValueString :: ToSQLValue String where toSQLValue = toForeign