Skip to content

serprime/clutch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Usage

  (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.4"])

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:

About

A Clojure library for Apache CouchDB.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 99.7%
  • JavaScript 0.3%