Permalink
Browse files

0.5.1

Signed-off-by: Alexander Dorofeev <aka.spin@gmail.com>
  • Loading branch information...
1 parent bb468c1 commit cc5a3ee5e7a01c66333cec77491425e24c0bf06c @akaspin committed Feb 4, 2012
Showing with 20 additions and 8 deletions.
  1. +1 −1 ChangeLog
  2. +1 −1 couchdb-conduit.cabal
  3. +9 −1 src/Database/CouchDB/Conduit.hs
  4. +9 −5 src/Database/CouchDB/Conduit/View.hs
View
@@ -1,4 +1,4 @@
- 03.02.2012, Version 0.5.0 (Stable) * Expose parser-independent methods in main module. * Expose Implicit methods. * Remove ambiguous database parameter from connection. * Add unambiguous database parameter in all methods. 03.02.2012, Version 0.4.2 * Update dependencies contraints. 24.01.2012, Version 0.4.1 * `couchSecureDB` lost db argument. 24.01.2012, Version 0.4.0 * Detailed error type. * Throw exception on `304`. * Database API lost db argument. * `couchViewPut*` -> `couchPutView` 22.01.2012, Version 0.3.0.1 * Constraints in cabal 19.01.2012, Version 0.3.0.0 * Fix for new http-conduit types 16.01.2012, Version 0.2.1.1 * Fixes for couchViewPut and couchSecureDB. 16.01.2012, Version 0.2.1 * Secure DB. 16.01.2012, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2012, Version 0.2.0 * Low-lewel API * "Don't care" versions of couchPut. * Brain-free couchRev'. * All database methods ignores DB in connection. * couchPutDB' renamed to couchPutDB_. * Database replication. 14.01.2012, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2012, Version 0.1.2.0 * Authentification 11.01.2012, Version 0.1.1.0
+ 04.02.2012, Version 0.5.1 (Stable) * Docs. * Quote query parameter helper. 03.02.2012, Version 0.5.0 (Stable) * Expose parser-independent methods in main module. * Expose Implicit methods. * Remove ambiguous database parameter from connection. * Add unambiguous database parameter in all methods. 03.02.2012, Version 0.4.2 * Update dependencies contraints. 24.01.2012, Version 0.4.1 * `couchSecureDB` lost db argument. 24.01.2012, Version 0.4.0 * Detailed error type. * Throw exception on `304`. * Database API lost db argument. * `couchViewPut*` -> `couchPutView` 22.01.2012, Version 0.3.0.1 * Constraints in cabal 19.01.2012, Version 0.3.0.0 * Fix for new http-conduit types 16.01.2012, Version 0.2.1.1 * Fixes for couchViewPut and couchSecureDB. 16.01.2012, Version 0.2.1 * Secure DB. 16.01.2012, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2012, Version 0.2.0 * Low-lewel API * "Don't care" versions of couchPut. * Brain-free couchRev'. * All database methods ignores DB in connection. * couchPutDB' renamed to couchPutDB_. * Database replication. 14.01.2012, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2012, Version 0.1.2.0 * Authentification 11.01.2012, Version 0.1.1.0
* API Changes. `couchViewPut` moved to Database.CouchDB.Design and lost
language argument.
* Tests. 10.01.2012, Version 0.1.0.1
View
@@ -1,5 +1,5 @@
name: couchdb-conduit
-version: 0.5.0
+version: 0.5.1
cabal-version: >= 1.8
build-type: Simple
stability: Stable
@@ -1,3 +1,5 @@
+{-# LANGUAGE OverloadedStrings #-}
+
{- | CouchDB
To work with concrete objects, use the following modules:
@@ -41,10 +43,13 @@ module Database.CouchDB.Conduit (
-- * "Database.CouchDB.Conduit.Generic" Generic JSON methods
couchRev,
couchRev',
- couchDelete
+ couchDelete,
+ -- * Utility
+ quoteQueryParam
) where
+import Data.ByteString (ByteString, append)
import Data.Conduit (ResourceT)
import Database.CouchDB.Conduit.Internal.Connection
import qualified Database.CouchDB.Conduit.Internal.Doc as D
@@ -72,3 +77,6 @@ couchDelete :: MonadCouch m =>
-> ResourceT m ()
couchDelete db p = D.couchDelete (mkPath [db, p])
+-- | Simple query param quotation.
+quoteQueryParam :: ByteString -> ByteString
+quoteQueryParam a = "\"" `append` a `append` "\""
@@ -24,7 +24,10 @@ import qualified Data.HashMap.Lazy as M
import qualified Data.Aeson as A
import Data.Attoparsec
-import Data.Conduit
+import Data.Conduit (ResourceIO, ResourceT,
+ Source, Conduit, Sink, ($$), ($=),
+ sequenceSink, SequencedSinkResponse(..),
+ resourceThrow )
import qualified Data.Conduit.List as CL
import qualified Data.Conduit.Attoparsec as CA
@@ -53,7 +56,7 @@ import Database.CouchDB.Conduit.LowLevel (couch, protect')
-- | Run CouchDB view in manner like 'H.http'.
--
--- > runCouch def {couchDB="mydb"} $ do
+-- > runCouch def $ do
-- >
-- > -- Print all upon receipt.
-- > src <- couchView "mydb" "mydesign" "myview" []
@@ -77,13 +80,14 @@ couchView db designDocName viewName q = do
-- | Brain-free version of 'couchView'. Takes 'Sink' to consume response.
--
--- > runCouch def {couchDB="mydb"} $ do
+-- > runCouch def $ do
-- >
-- > -- Print all upon receipt.
--- > couchView' "mydesign" "myview" [] $ CL.mapM_ (liftIO . print)
+-- > couchView' "mydb" "mydesign" "myview" [] $ CL.mapM_ (liftIO . print)
-- >
-- > -- ... Or extract row value and consume
--- > res <- couchView' "mydesign" "myview" [] $ rowValue =$ CL.consume
+-- > res <- couchView' "mydb" "mydesign" "myview" [] $
+-- > rowValue =$ CL.consume
couchView' :: MonadCouch m =>
Path -- ^ Database
-> Path -- ^ Design document

0 comments on commit cc5a3ee

Please sign in to comment.