|
|
|
|
|
Description |
Interface to CouchDB.
|
|
Synopsis |
|
data CouchMonad a | | runCouchDB :: String -> Int -> CouchMonad a -> IO a | | runCouchDB' :: CouchMonad a -> IO a | | data DB | | db :: String -> DB | | isDBString :: String -> Bool | | createDB :: String -> CouchMonad () | | dropDB :: String -> CouchMonad Bool | | data Doc | | data Rev | | doc :: String -> Doc | | isDocString :: String -> Bool | | newNamedDoc :: JSON a => DB -> Doc -> a -> CouchMonad (Either String Rev) | | newDoc :: JSON a => DB -> a -> CouchMonad (Doc, Rev) | | updateDoc :: JSON a => DB -> (Doc, Rev) -> a -> CouchMonad (Maybe (Doc, Rev)) | | deleteDoc :: DB -> (Doc, Rev) -> CouchMonad Bool | | forceDeleteDoc :: DB -> Doc -> CouchMonad Bool | | getDocPrim :: DB -> Doc -> CouchMonad (Maybe (Doc, Rev, [(String, JSValue)])) | | getDoc :: JSON a => DB -> Doc -> CouchMonad (Maybe (Doc, Rev, a)) | | getAndUpdateDoc :: JSON a => DB -> Doc -> (a -> a) -> CouchMonad (Maybe Rev) | | getAllDocIds :: DB -> CouchMonad [Doc] | | | | newView :: String -> String -> [CouchView] -> CouchMonad () | | queryView :: JSON a => DB -> Doc -> Doc -> [(String, JSValue)] -> CouchMonad [(Doc, a)] | | queryViewKeys :: DB -> Doc -> Doc -> [(String, JSValue)] -> CouchMonad [Doc] |
|
|
|
Initialization
|
|
|
A computation that interacts with a CouchDB database. This monad
encapsulates the IO monad, a persistent HTTP connnection to a
CouchDB database and enough information to re-open the connection
if it is closed.
| Instances | |
|
|
|
|
|
|
Connects to the CouchDB server at localhost:5984.
|
|
Databases
|
|
|
Database name
| Instances | |
|
|
|
Returns a safe database name. Signals an error if the name is
invalid.
|
|
|
|
|
Creates a new database. Throws an exception if the database already
exists.
|
|
|
|
|
Documents
|
|
|
Document name
| Instances | |
|
|
|
Document revision number.
| Instances | |
|
|
|
Returns a safe document name. Signals an error if the name is
invalid.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: DB | database
| -> Doc | document identifier
| -> CouchMonad Bool | | Delete a doc by document identifier (revision number not needed). This
operation first retreives the document to get its revision number. It fails
if the document doesn't exist or there is a conflict.
|
|
|
|
:: DB | database name
| -> Doc | document name
| -> CouchMonad (Maybe (Doc, Rev, [(String, JSValue)])) | Nothing if the document does not exist.
| Gets a document as a raw JSON value. Returns the document id,
revision and value as a JSObject. These fields are queried lazily,
and may fail later if the response from the server is malformed.
|
|
|
|
|
|
|
:: JSON a | | => DB | database
| -> Doc | document name
| -> a -> a | update function
| -> CouchMonad (Maybe Rev) | If the update succeeds,
return the revision number
of the result.
|
|
|
|
|
|
Views
|
|
Creating and querying views
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Produced by Haddock version 2.3.0 |