It's nice, while debugging, to have access to temporary views; the
attached patch makes it possible.  For instance:

  (let ((db (make-connection database: "test")))
    ;; first document
    (send-temp-view-request
     db
     '#(("map" . "function(doc) { emit(null, doc); }"))
     '(("limit" . "1"))))
Index: trunk/couchdb.scm
===================================================================
--- trunk/couchdb.scm   (revision 18089)
+++ trunk/couchdb.scm   (working copy)
@@ -179,6 +179,14 @@
                                   rev: (json-ref 'rev response)))))
 
 
+(define (send-temp-view-request conn body #!optional (query '()))
+  (send-request (make-request uri: (update-uri
+                                    (uri-path-append
+                                     (connection-uri conn) "_temp_view")
+                                    query: query)
+                              method: 'POST)
+                (with-output-to-string (lambda () (json-write body)))))
+
 ;; Request method for the view API
 (define (send-view-request conn view method #!key (query '()))
   (assert-connection-database conn 'send-view-request)
@@ -243,4 +251,4 @@
 (define (get-database-info conn)
   (send-database-request conn 'GET))
 
-)
\ No newline at end of file
+)
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to