Created
May 6, 2011 13:51
-
-
Save et4te/958973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deleteBucket c b = do | |
ks ← foldKeys c b (λ ks k → return (k:ks)) [] | |
mapM (λ k → deleteRV c b k) ks | |
main = do | |
conn ← connect devClient | |
r ← loadFixture conn roleFixture | |
u ← loadFixture conn userFixture | |
roles ← getBucketRV conn (L.pack "role") | |
users ← getBucketRV conn (L.pack "user") | |
result ← mapReduce conn (JSON $ encode $ object | |
[(T.pack "inputs") .= "user", | |
(T.pack "query") .= | |
[object [(T.pack "link") .= | |
(object [(T.pack "bucket") .= "role", | |
(T.pack "keep") .= True])]]]) | |
-- These two functions fail as map_reduce returns asynchronously | |
dr ← deleteBucket conn (L.pack "role") | |
du ← deleteBucket conn (L.pack "user") | |
putStrLn $ show result | |
disconnect conn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment