Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Clojure library for Apache CouchDB.
Clojure
branch: master

This branch is 8 commits ahead, 184 commits behind clojure-clutch:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
resources/META-INF
src/com/ashafa
test
.gitignore
README.textile
pom.xml
project.clj

README.textile

Clutch

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



  (ns #^{:author "Tunde Ashafa"}
      clutch-example
      (:use com.ashafa.clutch))

  (def example-database
    (get-database {:name     "clutch_test_db"
                   :language "clojure"}))     ; use Clutch (Clojure) view server

  (with-db example-database
           ;; 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
                {:map    (fn [doc] [[nil (:test-grade doc)]])
                 :reduce (fn [keys values _] (apply + values))}))) ; => 60

Download and Installation

Clutch uses Leiningen. For installation and help on using Leiningen visit the github repo .

To include Clutch in your project, simply add the following to your project.clj:

(:dependencies [com.ashafa/clutch "0.2.2"])

and run…

lein deps

Configuring your CouchDB installation to use the Clutch view server

To use Clojure for views and filters, add the following to the ‘local.ini’ file of your CouchDB installation (replacing <path to…> with the appropiate paths to the jars which reside in the “lib” folder in your project folder).

  [query_servers]
  clojure = java -cp <path to clojure.jar>/clojure.jar:<path to clojure-contrib.jar>/clojure-contrib.jar:clutch.jar com.ashafa.clutch.view_server

Contributors

Appreciations go out to:

Something went wrong with that request. Please try again.