Browse Source

fix yesod mongodb-raw test

Greg Weber 12 years ago
parent
commit
d7f21afe84
1 changed files with 5 additions and 4 deletions
  1. 5 4
      yesod/bench/src/yesod.hs

+ 5 - 4
yesod/bench/src/yesod.hs

@@ -107,14 +107,14 @@ intQuery :: forall (m :: * -> *) (m1 :: * -> *) val backend.
            -> Int64 -> m Value
            -> Int64 -> m Value
 intQuery db i = do
 intQuery db i = do
     Just x <- db $ get (Key $ PersistInt64 i)
     Just x <- db $ get (Key $ PersistInt64 i)
-    return $ jsonResult i (worldRandomNumber x)
+    return $ jsonResult (worldRandomNumber x)
   where
   where
-    jsonResult :: Int64 -> Int -> Value
-    jsonResult i n = object ["id" .= i, "randomNumber" .= n]
+    jsonResult :: Int -> Value
+    jsonResult n = object ["id" .= i, "randomNumber" .= n]
 
 
 rawMongoIntQuery :: Mongo.Val v => v -> Handler Value
 rawMongoIntQuery :: Mongo.Val v => v -> Handler Value
 rawMongoIntQuery i = do
 rawMongoIntQuery i = do
-    Just x <- runMongoDB $ Mongo.findOne (Mongo.select ["id" =: i] "World")
+    Just x <- runMongoDB $ Mongo.findOne (Mongo.select ["id" =: i] "world")
     return $ documentToJson x
     return $ documentToJson x
 
 
 multiRandomHandler :: ToJSON a
 multiRandomHandler :: ToJSON a
@@ -136,6 +136,7 @@ documentToJson = object . map toAssoc
 instance ToJSON Mongo.Value where
 instance ToJSON Mongo.Value where
   toJSON (Mongo.Int32 i)  = toJSON i
   toJSON (Mongo.Int32 i)  = toJSON i
   toJSON (Mongo.Int64 i)  = toJSON i
   toJSON (Mongo.Int64 i)  = toJSON i
+  toJSON (Mongo.Float f)  = toJSON f
   toJSON (Mongo.Doc d)   = documentToJson d
   toJSON (Mongo.Doc d)   = documentToJson d
   toJSON s = error $ "no convert for: " ++ show s
   toJSON s = error $ "no convert for: " ++ show s