How to write Native Erlang list functions in CouchDB

I am trying to write Erlang list functions in CouchDB, however I am not familiar with returned data types and how to manage them. I would like someone to show me how to translate the simple Javascript List function below into the Erlang list function. That would be a good moment for me.

function(head, req) { var row,resp={},data=[]; if(head){ resp["total_rows"] = head.total_rows; } while(row = getRow()) { data.push(row); } resp.rows = data; return JSON.stringify(resp); } 

Thanks in advance.

+6
source share
1 answer

You looked at the couchdb test kit. You will find the erlang views in utils / script / test / erlang_views.js

The code in the test suite often helps me when I'm stuck.

+3
source

Source: https://habr.com/ru/post/920486/


All Articles