Add FromSQLValue Number

This commit is contained in:
rightfold 2017-04-18 14:19:57 +02:00
parent 8e09f99502
commit e58c71e26c
No known key found for this signature in database
GPG Key ID: 199D0373AC917A8F

View File

@ -28,7 +28,7 @@ import Data.Array (head, uncons)
import Data.ByteString (ByteString)
import Data.DateTime.Instant (Instant)
import Data.Either (Either(..))
import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readString, toForeign, unsafeFromForeign)
import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readNumber, readString, toForeign, unsafeFromForeign)
import Data.Foreign.Null (writeNull)
import Data.List (List)
import Data.List as List
@ -114,6 +114,9 @@ instance fromSQLValueInt :: FromSQLValue Int where
instance toSQLValueNumber :: ToSQLValue Number where
toSQLValue = toForeign
instance fromSQLValueNumber :: FromSQLValue Number where
fromSQLValue = fromRight <<< runExcept <<< readNumber
instance toSQLValueString :: ToSQLValue String where
toSQLValue = toForeign