couchdb_connector v0.4.0 Couchdb.Connector.Reader

The Reader module provides functions to retrieve documents or uuids from CouchDB.

Examples

db_props = %{protocol: "http", hostname: "localhost",database: "couchdb_connector_test", port: 5984}
%{database: "couchdb_connector_test", hostname: "localhost", port: 5984, protocol: "http"}

Couchdb.Connector.Reader.get(db_props, "_not_there_")
{:error, "{\"error\":\"not_found\",\"reason\":\"missing\"}\n"}

Couchdb.Connector.Reader.get(db_props, "ca922a07263524e2feb5fe398303ecf8")
{:ok,
  "{\"_id\":\"ca922a07263524e2feb5fe398303ecf8\",\"_rev\":\"1-59414...\",\"key\":\"value\"}\n"}

Couchdb.Connector.Reader.fetch_uuid(db_props)
{:ok, "{\"uuids\":[\"1a013a4ce3...\"]}\n"}

Summary

Functions

Fetch a single uuid from CouchDB for use in a a subsequent create operation

Retrieve the document given by database properties and id, using no authentication

Retrieve the document given by database properties and id, using the given basic auth credentials for authentication

Functions

fetch_uuid(db_props)
fetch_uuid(Couchdb.Connector.Types.db_properties) ::
  {:ok, String.t} |
  {:error, String.t}

Fetch a single uuid from CouchDB for use in a a subsequent create operation.

get(db_props, id)

Retrieve the document given by database properties and id, using no authentication.

get(db_props, basic_auth, id)

Retrieve the document given by database properties and id, using the given basic auth credentials for authentication.