couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject [ANN] couchtiny
Date Fri, 26 Jun 2009 10:15:18 GMT
The world probably doesn't need yet another Ruby API to CouchDB, but I am
releasing my code anyway :-)

http://github.com/candlerb/couchtiny/tree/master

Currently only available by git-clone or download a tarball from github.

### SUMMARY ###

This library is a tiny CouchDB API inspired by CouchRest, aiming to be lean,
simple to understand, and closely aligned to CouchDB's own API. It also
provides pluggable interfaces for JSON parsing, UUID generation and HTTP
client.

Probably the biggest conceptual difference over CouchRest is the use of
delegation to an underlying hash, rather than subclassing. This allows
zero-copy object instantiation, and the ability to use a model as a proxy
onto part of a larger document.

NOTE: This code was written so I had something easy to modify for my own
use, and therefore is subject to change wildly at my personal whim.

### FEATURES ###

Low-level:

* CouchDB actions map directly to method names (e.g. GET->get, PUT->put,
  _all_docs->all_docs)
* Pluggable JSON interface
* Pluggable HTTP interface
* Pluggable UUID generator
* Exceptions include the error/reason message returned by CouchDB
* bulk_docs maps directly to a single HTTP call, so the results can
  be checked
* Can put a document without touching its _rev (useful for storing the
  same document onto multiple databases, e.g. design docs)

High-level:

* No properties, validations, or casts (although you can use before_save
  and after_find callbacks)
* Document delegates to Hash, rather than subclasses it
* Single design document per application, rather than class, by default
* Views can have :reduce=>false as a default option
* Single 'all' view per application, with reduce to count objects by class
* Configurable 'type' attribute
* 'type' attribute validated against known model names, so DB user cannot
  instantiate arbitrary classes
* Polymorphic views: each object is instantiated with the class in the DB
* View with block (streamed view) yields fully instantiated objects
* Finder methods in a separate class, so they can be cleanly requested
  on different database instances

General:

* Around 25% of the size of CouchRest
* No 'require "rubygems"'
* No autoload
* No monkey patches

Mime
View raw message