Permalink
Browse files

Release bump

Signed-off-by: Alexander Dorofeev <aka.spin@gmail.com>
  • Loading branch information...
1 parent 9c02d4d commit 54939c3aeb31f4f00304672d9872860c5072f665 @akaspin committed Jan 24, 2012
View
@@ -1,4 +1,4 @@
- In work, Version 0.4.0 * Detailed error type. * Throw exception on `304`. 22.01.2011, Version 0.3.0.1 * Constraints in cabal 19.01.2011, Version 0.3.0.0 * Fix for new http-conduit types 16.01.2011, Version 0.2.1.1 * Fixes for couchViewPut and couchSecureDB. 16.01.2011, Version 0.2.1 * Secure DB. 16.01.2011, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2011, 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.2011, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2011, Version 0.1.2.0 * Authentification 11.01.2011, Version 0.1.1.0
+ 24.01.2011, Version 0.4.0 * Detailed error type. * Throw exception on `304`. * Database API lost db argument. * `couchViewPut*` -> `couchPutView` 22.01.2011, Version 0.3.0.1 * Constraints in cabal 19.01.2011, Version 0.3.0.0 * Fix for new http-conduit types 16.01.2011, Version 0.2.1.1 * Fixes for couchViewPut and couchSecureDB. 16.01.2011, Version 0.2.1 * Secure DB. 16.01.2011, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2011, 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.2011, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2011, Version 0.1.2.0 * Authentification 11.01.2011, Version 0.1.1.0
* API Changes. `couchViewPut` moved to Database.CouchDB.Design and lost
language argument.
* Tests. 10.01.2011, Version 0.1.0.1
@@ -148,8 +148,7 @@ class ResourceIO m => MonadCouch m where
instance (ResourceIO m) => MonadCouch (ReaderT CouchConnection m) where
couchConnection = ask
--- | A Couch DB Error.
--- Note about @304 - Not Modified@. If
+-- | A CouchDB Error.
data CouchError
= CouchHttpError Int B.ByteString
-- ^ Error comes from http.
@@ -158,7 +157,8 @@ data CouchError
-- parsing the response.
| NotModified
-- ^ /Is not an error actually/. It is thrown when CouchDB returns
- -- @304 - Not Modified@ response to the request.
+ -- @304 - Not Modified@ response to the request. See
+ -- <http://wiki.apache.org/couchdb/HTTP_Document_API>
deriving (Show, Typeable)
instance Exception CouchError
@@ -3,10 +3,8 @@
{- | CouchDB database methods.
-> runCouch def $ couchPutDb "my_new_db"
-> runCouch def {couchDB="my_new_db"} $ couchPutDb "another_new_db"
-
-/Note./ All database methods ignores database settings in connection.
+> runCouch def {couchDB="my_db"} $ couchPutDb
+> runCouch def {couchDB="my_new_db"} $ couchPutDb
-}
module Database.CouchDB.Conduit.DB (
@@ -20,12 +18,8 @@ module Database.CouchDB.Conduit.DB (
couchSecureDB
) where
---import Control.Applicative ((<$>), (<*>), empty)
-
import qualified Data.ByteString as B
import qualified Data.Aeson as A
---import Data.Generics (Data, Typeable)
---import Data.Default (Default (def))
import Data.Conduit (ResourceT)
@@ -37,29 +31,22 @@ import Database.CouchDB.Conduit.LowLevel (couch, protect, protect')
-- | Create CouchDB database.
-couchPutDB :: MonadCouch m =>
- Path -- ^ CouchDB Database name.
- -> ResourceT m ()
-couchPutDB p = couch HT.methodPut (const p) [] []
+couchPutDB :: MonadCouch m => ResourceT m ()
+couchPutDB = couch HT.methodPut id [] []
(H.RequestBodyBS B.empty) protect'
>> return ()
-- | \"Don't care\" version of couchPutDb. Create CouchDB database only in its
-- absence. For this it handles @412@ responses.
-couchPutDB_ :: MonadCouch m =>
- Path -- ^ CouchDB Database name.
- -> ResourceT m ()
-couchPutDB_ p =
- couch HT.methodPut (const p) [] []
+couchPutDB_ :: MonadCouch m => ResourceT m ()
+couchPutDB_ = couch HT.methodPut id [] []
(H.RequestBodyBS B.empty)
(protect [200, 201, 202, 304, 412] return)
>> return ()
-- | Delete a database.
-couchDeleteDB :: MonadCouch m =>
- Path -- ^ CouchDB Database name.
- -> ResourceT m ()
-couchDeleteDB p = couch HT.methodDelete (const p) [] []
+couchDeleteDB :: MonadCouch m => ResourceT m ()
+couchDeleteDB = couch HT.methodDelete id [] []
(H.RequestBodyBS B.empty) protect'
>> return ()
@@ -4,8 +4,8 @@
-- convenient for bootstrapping and testing.
module Database.CouchDB.Conduit.Design (
- couchViewPut_,
- couchViewPut'
+ couchPutView_,
+ couchPutView'
) where
import Prelude hiding (catch)
@@ -26,23 +26,23 @@ import Database.CouchDB.Conduit.Internal.Doc (couchGetWith,
-- | Put view in design document if it not exists. If design document does
-- not exist, it will be created.
-couchViewPut_ :: MonadCouch m =>
+couchPutView_ :: MonadCouch m =>
Path -- ^ Design document
-> Path -- ^ View name
-> B.ByteString -- ^ Map function
-> Maybe B.ByteString -- ^ Reduce function
-> ResourceT m Revision
-couchViewPut_ = couchViewPutInt True
+couchPutView_ = couchViewPutInt True
-- | Brute-force version of 'couchViewPut''. Put view in design document.
-- If design document does not exist, it will be created.
-couchViewPut' :: MonadCouch m =>
+couchPutView' :: MonadCouch m =>
Path -- ^ Design document
-> Path -- ^ View name
-> B.ByteString -- ^ Map function
-> Maybe B.ByteString -- ^ Reduce function
-> ResourceT m Revision
-couchViewPut' = couchViewPutInt False
+couchPutView' = couchViewPutInt False
-----------------------------------------------------------------------------
-- Internal
@@ -37,8 +37,10 @@ case_justConnect = runCouch def $ do
-- | Put and delete
case_dbPut :: Assertion
-case_dbPut = runCouch def {couchLogin = login, couchPass=pass} $ do
- couchPutDB_ "cdbc_dbputdel"
- couchDeleteDB "cdbc_dbputdel"
+case_dbPut = runCouch def {couchLogin = login,
+ couchPass=pass,
+ couchDB="cdbc_dbputdel"} $ do
+ couchPutDB_
+ couchDeleteDB
@@ -10,10 +10,10 @@ import Database.CouchDB.Conduit.DB
import CouchDBAuth
setupDB :: ByteString -> IO ()
-setupDB n = runCouch (conn n) $ couchPutDB_ n
+setupDB n = runCouch (conn n) $ couchPutDB_
tearDB :: ByteString -> IO ()
-tearDB n = runCouch (conn n) $ couchDeleteDB n
+tearDB n = runCouch (conn n) $ couchDeleteDB
-- | Connection connection. See readme
conn :: Path -> CouchConnection
@@ -53,7 +53,7 @@ case_createView :: Assertion
case_createView = bracket_
(setupDB db)
(tearDB db) $ runCouch (conn db) $ do
- rev <- couchViewPut' "mydesign" "myview"
+ rev <- couchPutView' "mydesign" "myview"
"function(doc){emit(null, doc);}" Nothing
rev' <- CCG.couchRev "_design/mydesign"
liftIO $ rev @=? rev'
@@ -63,8 +63,8 @@ case_createView = bracket_
case_bigValues :: Assertion
case_bigValues = bracket_
(runCouch (conn db) $ do
- couchPutDB_ db
- _ <- couchViewPut' "mydesign" "myview"
+ couchPutDB_
+ _ <- couchPutView' "mydesign" "myview"
"function(doc){emit(doc.intV, doc);}" Nothing
mapM_ (\n -> CCG.couchPut' (docName n) [] $ doc n) [1..20]
)
@@ -81,8 +81,8 @@ data ReducedView = ReducedView Int deriving (Show, Eq, Data, Typeable)
case_withReduce :: Assertion
case_withReduce = bracket_
(runCouch (conn db) $ do
- couchPutDB_ db
- _ <- couchViewPut' "mydesign" "myview"
+ couchPutDB_
+ _ <- couchPutView' "mydesign" "myview"
"function(doc){emit(doc.intV, doc.intV);}"
$ Just "function(keys, values){return sum(values);}"
mapM_ (\n -> CCG.couchPut' (docName n) [] $ doc n) [1..20])

0 comments on commit 54939c3

Please sign in to comment.