Makes Array Foreign an instance of ToSQLRow

For when the user wants to convert the values to foreign by themselves.
This commit is contained in:
Abhinav Sarkar 2017-10-06 19:03:22 +05:30 committed by GitHub
parent 97583e0cc8
commit 4178f9005e

View File

@ -13,6 +13,9 @@ class ToSQLRow a where
-- | Convert things from SQL rows. -- | Convert things from SQL rows.
class FromSQLRow a where class FromSQLRow a where
fromSQLRow :: Array Foreign -> Either String a fromSQLRow :: Array Foreign -> Either String a
instance toSQLRowForeignArray :: ToSQLRow (Array Foreign) where
toSQLRow = id
-- | A row with 0 fields. -- | A row with 0 fields.
data Row0 = Row0 data Row0 = Row0
@ -602,4 +605,4 @@ instance fromSQLRowRow19 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
instance toSQLRowRow19 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p, ToSQLValue q, ToSQLValue r, ToSQLValue s) => ToSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) where instance toSQLRowRow19 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p, ToSQLValue q, ToSQLValue r, ToSQLValue s) => ToSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) where
toSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) = toSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) =
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p, toSQLValue q, toSQLValue r, toSQLValue s] [toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p, toSQLValue q, toSQLValue r, toSQLValue s]