couch-simple-0.0.1.0: A modern, lightweight, complete client for CouchDB

CopyrightCopyright (c) 2015, Michael Alan Dorman
LicenseMIT
Maintainermdorman@jaunder.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Database.Couch.Explicit.Local

Description

This module is intended to be import qualified. No attempt has been made to keep names of types or functions from clashing with obvious or otherwise commonly-used names.

The functions here are derived from (and presented in the same order as) http://docs.couchdb.org/en/1.6.1/api/local/index.html.

Synopsis

Documentation

get Source

Arguments

:: (FromJSON a, MonadIO m) 
=> RetrieveDoc

Parameters for document retrieval

-> DocId

The document ID

-> Maybe DocRev

An optional document revision

-> Context 
-> m (Result a) 

Get the specified local document

The return value is an object whose fields often vary, so it is most easily decoded as a Value:

>>> value :: Result Value <- Doc.get "pandas" Nothing ctx

If the specified DocRev matches, returns a JSON Null, otherwise a JSON value for the document.

Status: Complete

put Source

Arguments

:: (FromJSON a, MonadIO m, ToJSON b) 
=> ModifyDoc

Parameters for document modification

-> DocId

The document ID

-> Maybe DocRev

An optional document revision

-> b

The document

-> Context 
-> m (Result a) 

Create or replace the specified local document

The return value is an object that can hold "id" and "rev" keys, but if you don't need those values, it is easily decoded into a Bool with our asBool combinator:

>>> value :: Result Bool <- DocBase.put modifyDoc "pandas" Nothing SomeValue ctx >>= asBool

Status: Complete

delete Source

Arguments

:: (FromJSON a, MonadIO m) 
=> ModifyDoc

Parameters for document modification

-> DocId

The document ID

-> Maybe DocRev

An optional document revision

-> Context 
-> m (Result a) 

Delete the specified local document

The return value is an object that can hold "id" and "rev" keys, but if you don't need those values, it is easily decoded into a Bool with our asBool combinator:

>>> value :: Result Bool <- DocBase.delete "prefix" modifyDoc "pandas" Nothing ctx >>= asBool

Status: Complete

copy Source

Arguments

:: (FromJSON a, MonadIO m) 
=> ModifyDoc

Parameters for document modification

-> DocId

The document ID

-> Maybe DocRev

An optional document revision

-> DocId

The destination document ID

-> Context 
-> m (Result a) 

Copy the specified local document

The return value is an object that can hold "id" and "rev" keys, but if you don't need those values, it is easily decoded into a Bool with our asBool combinator:

>>> value :: Result Bool <- DocBase.delete "prefix" modifyDoc "pandas" Nothing ctx >>= asBool

Status: Complete