couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi <losth...@yandex.ru>
Subject javascript user library
Date Wed, 29 Apr 2009 20:27:43 GMT
Hi, All!

I would like to suggest some way to have library functions in the javascript (or other) views.

Currently, if I have some structured entries and a bunch of "library" functions to peek values
from them, which are highly used in many views, I have two possible ways:

1. to include the library functions in the each view;
2. to patch couchdb's main.js and to include the library in it.

Both ways are ugly, imho...

I realize, it would be cool to have, say, "/_library/libname" document with the library body.
And to have the optional parameter 'library' in the view's definition:

{'map': 'function body', 'reduce': 'function body', 'library': ['libname', ....]}

so when couchdb pass the view's functions to the view server it will pass not only 'add_fun',
but also 'add_lib' command with the library body to evaluate in the view execution environment.

Unfortunately, I'm far from being an expert in couchdb ideology to propose more constructive
ideas about :-)

-- 
WBR, Dmi.

Mime
View raw message