A Clojure library for Apache CouchDB.
Clojure
Pull request Compare This branch is 4 commits ahead, 262 commits behind clojure-clutch:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/com/ashafa
test
README.textile
mime.types
project.clj

README.textile

Clutch

  (ns clutch
    (:use com.ashafa.clutch))

  (def clutch-test-database
    (create-database {:name     "clutch_test_db"
                      :language "clojure"}))     ; use Clutch (Clojure) view server with database

  (def backup-database 
    (create-database {:name "backup_db"
                      :host "10.1.192.23"}))     ; remote CouchDB server
                      
  (with-db clutch-test-db
           ;; insert or update multiple documents
           (bulk-update [{:test-grade 10}
                         {:test-grade 20}
                         {:test-grade 30}])
           ;; create temporary or permanent views using clojure 
           (ad-hoc-view
             (with-clj-view-server
                (fn [doc] [[nil (:test-grade doc)]])       ; map
                (fn [keys values _] (apply + values))))) ; reduce

  (replicate-database clutch-test-database backup-database) ; backup 'cluth_test_db' to 'backup_db' on CouchDB server at 10.1.192.23

Clutch is a Clojure library for Apache CouchDB. Although it’s in a very early stage of development (Clutch API subject to change), Clutch supports most of the basic Apache CouchDB APIs. To get a sense of where Clutch is at, please view the included tests.

Clutch (Clojure) View Server

In order to use Clojure for views, you must add the following to the ‘local.ini’ file of your Apache CouchDB installation (replacing <path to…> with the appropiate paths).

  [query_servers]
  clojure = java -cp <path to clojure.jar>/clojure.jar:<path to clojure-contrib.jar or clojure-contrib source>/clojure-contrib(.jar|/src) clojure.main <path to clutch project folder>/clutch/src/com/ashafa/clutch/view_server.clj

Dependencies

Clutch requires:

TODOs

  • Documentation!
  • Use streams instead of java.io.File for attachments apis
  • Revisions
  • More robust tests