gnieh.sohva

dm

package dm

Visibility
  1. Public
  2. All

Type Members

  1. trait DesignManager[Result[_]] extends AnyRef

    A design manager allows people to easily manage design documents stored in a CouchDB database.

    A design manager allows people to easily manage design documents stored in a CouchDB database. It allows for storing, updating, deleting designs, views and more from a bunch of files stored in a directory. The structure of the directory is as follows:

    base
    |-- design1
    |   |-- revision.json
    |   |-- views
    |   |   |-- view1
    |   |   |   `-- map.js
    |   |   `-- view2
    |   |       |-- map.js
    |   |       `-- reduce.js
    `-- design2
        |-- filters
        |   |-- filter1.js
        |   `-- filter2.js
        |-- language.json
        |-- lists
        |   |-- list1.js
        |   `-- list2.js
        |-- rewrites
        |   |-- rewrite1.json
        |   |-- rewrite2.json
        |   `-- rewrite3.json
        |-- shows
        |   `-- show.js
        |-- updates
        |   `-- update.js
        |-- validate_doc_update.js
        `-- views
            `-- view
                `-- map.js

    The language.json file must contain a json object with two fields:

    • name: the design language (e.g. javascript or coffeescript),
    • extension: the file extension (e.g. js or coffee). If it is not present, javascript is assumed as language and file extension is js. The list of default extensions based in language name can be configured via the [typesafe config engine](https://github.com/typesafehub/config/). To add a new language binding, you must add them in the sohva.dm.extensions configuration object. For example some of the default extensions look like this:
    sohva {
      dm {
        extensions {
          javascript = js
          coffeescript = coffee
        }
      }
    }

    All js (or whatever the language is) files must contain the definition of a single function corresponding to the document field. It also allows for bi-directional synchronization between design documents in the database and the ones described in the directory. The rewrite objects are sorted alphabetically by the file name in the array.

    The revision.json file, if present, must contain a string specifying the last known revision in the database that corresponds to this version of the design document. This allows for more efficient synchronization of design documents. It is automatically added or updated when a design document is imported from a database or synchronized if trackRevisions is set to true. If it is not present, and the document also exists in the database, upon synchronization, the local version of the design document is taken as reference in case of concurrent modifications and is added if missing in the database.

Ungrouped