WIP: put requests

This commit is contained in:
Joe Nelson
2014-09-07 22:03:45 -07:00
parent a4227b94d8
commit 22114532e6
4 changed files with 125 additions and 14 deletions
+7 -1
View File
@@ -1,6 +1,6 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Types(SqlRow(SqlRow), getRow) where
module Types where
import Database.HDBC (toSql, iToSql, SqlValue(..))
@@ -44,6 +44,12 @@ instance JSON.ToJSON SqlValue where
newtype SqlRow = SqlRow {getRow :: [(Text, SqlValue)] } deriving (Show)
sqlRowColumns :: SqlRow -> [Text]
sqlRowColumns = map fst . getRow
sqlRowValues :: SqlRow -> [SqlValue]
sqlRowValues = map snd . getRow
instance JSON.FromJSON SqlRow where
parseJSON (JSON.Object m) = foldlWithKey' add (return $ SqlRow []) m
where