Skip to content

jeffdik/clutch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clutch

  (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

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 .

Download and Installation

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

To include Clutch in your project, in your project.clj add the following to your “:dependencies”:

[com.ashafa/clutch "0.2.1"]

… then from your command line, execute:

lein deps

This will create a compiled Clutch jar in the “/lib” (or path indicated by your leiningen project.clj file) of your project.

Working with the source

If you are working with a clone of Clutch from github for development, contribution, or testing purposes, in your command line in the project directory, execute:

lein install

This will leave a fully-compiled Clutch jar file in the project directory.

You can also run the Clutch tests by executing the following in your command line:

lein test test-clutch

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).

  [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

Requirements

Clutch is currently being tested on Apache CouchDB version 0.10.1

TODOs

  • Documentation
  • Revisions
  • More tests

Contributors

Appreciations go out to:

About

A Clojure library for Apache CouchDB.

Resources

Stars

Watchers

Forks

Packages

No packages published