Class DataMapper::Adapters::CouchDBAdapter
In: lib/couchdb_adapter/adapter.rb
Parent: AbstractAdapter

Methods

create   db_name   delete   escaped_db_name   new   read   update  

Constants

ConnectionError = Class.new(StandardError)

Public Class methods

Public Instance methods

Persists one or many new resources

@example

  adapter.create(collection)  # => 1

Adapters provide specific implementation of this method

@param [Enumerable<Resource>] resources

  The list of resources (model instances) to create

@return [Integer]

  The number of records that were actually saved into the data-store

@api semipublic

Returns the name of the CouchDB database.

@raise [RuntimeError] if the CouchDB database name is invalid.

Deletes one or many existing resources

@example

  adapter.delete(collection)  # => 1

Adapters provide specific implementation of this method

@param [Collection] collection

  collection of records to be deleted

@return [Integer]

  the number of records deleted

@api semipublic

Returns the name of the CouchDB database after being escaped.

Reads one or many resources from a datastore

@example

  adapter.read(query)  # => [ { 'name' => 'Dan Kubb' } ]

Adapters provide specific implementation of this method

@param [Query] query

  the query to match resources in the datastore

@return [Enumerable<Hash>]

  an array of hashes to become resources

@api semipublic

Updates one or many existing resources

@example

  adapter.update(attributes, collection)  # => 1

Adapters provide specific implementation of this method

@param [Hash(Property => Object)] attributes

  hash of attribute values to set, keyed by Property

@param [Collection] collection

  collection of records to be updated

@return [Integer]

  the number of records updated

@api semipublic

[Validate]