CouchdbDesignDocument

CouchdbDesignDocument

Synopsis

                    CouchdbDesignDocument;
                    CouchdbDesignDocumentClass;
CouchdbDesignDocument * couchdb_design_document_new     (void);
GSList *            couchdb_design_document_list_views  (CouchdbDesignDocument *document);
void                couchdb_design_document_free_views_list
                                                        (GSList *list);
void                couchdb_design_document_add_view    (CouchdbDesignDocument *document,
                                                         const char *name,
                                                         const char *map_function,
                                                         const char *reduce_function);
void                couchdb_design_document_delete_view (CouchdbDesignDocument *document,
                                                         const char *name);
enum                CouchdbDesignDocumentLanguage;
CouchdbDesignDocumentLanguage  couchdb_design_document_get_language
                                                        (CouchdbDesignDocument *document);
void                couchdb_design_document_set_language
                                                        (CouchdbDesignDocument *document,
                                                         CouchdbDesignDocumentLanguage language);

Description

Details

CouchdbDesignDocument

typedef struct {
	CouchdbDocument parent;
} CouchdbDesignDocument;


CouchdbDesignDocumentClass

typedef struct {
	CouchdbDocumentClass parent_class;
} CouchdbDesignDocumentClass;


couchdb_design_document_new ()

CouchdbDesignDocument * couchdb_design_document_new     (void);

Create a new design document, to contain views' code.

Returns :

A new CouchdbDesignDocument object.

couchdb_design_document_list_views ()

GSList *            couchdb_design_document_list_views  (CouchdbDesignDocument *document);

Return a list of the names of the views contained in the given CouchdbDesignDocument object.

document :

A CouchdbDesignDocument object

Returns :

A list of names of views. When no longer needed, this list should be freed by calling couchdb_design_document_free_views_list.

couchdb_design_document_free_views_list ()

void                couchdb_design_document_free_views_list
                                                        (GSList *list);

Free the list of views' names returned by couchdb_design_document_list_views.

list :

A list of views' names, as returned by couchdb_design_document_list_views

couchdb_design_document_add_view ()

void                couchdb_design_document_add_view    (CouchdbDesignDocument *document,
                                                         const char *name,
                                                         const char *map_function,
                                                         const char *reduce_function);

Add a new view to the given CouchdbDesignDocument object. If the view already exists, it will get replaced by the new one. To make the change permanent, the document must be saved to the database by calling couchdb_database_put_document.

document :

A CouchdbDesignDocument object

name :

Name of the view

map_function :

Source code for the map function

reduce_function :

Source code for the reduce function

couchdb_design_document_delete_view ()

void                couchdb_design_document_delete_view (CouchdbDesignDocument *document,
                                                         const char *name);

Delete a view from the given CouchdbDesignDocument object. To make the change permanent, the document must be saved to the database by calling couchdb_database_put_document.

document :

A CouchdbDesignDocument object

name :

Name of the view to remove

enum CouchdbDesignDocumentLanguage

typedef enum {
	COUCHDB_DESIGN_DOCUMENT_LANGUAGE_UNKNOWN,
	COUCHDB_DESIGN_DOCUMENT_LANGUAGE_JAVASCRIPT,
	COUCHDB_DESIGN_DOCUMENT_LANGUAGE_PYTHON
} CouchdbDesignDocumentLanguage;


couchdb_design_document_get_language ()

CouchdbDesignDocumentLanguage  couchdb_design_document_get_language
                                                        (CouchdbDesignDocument *document);

Return the programming language in which the views on the given design document are written.

document :

A CouchdbDesignDocument object

Returns :

A value representing the language the views are written in.

couchdb_design_document_set_language ()

void                couchdb_design_document_set_language
                                                        (CouchdbDesignDocument *document,
                                                         CouchdbDesignDocumentLanguage language);

Set the language used in the views contained in the given CouchdbDesignDocument object.

document :

A CouchdbDesignDocument object

language :

Language for the views in this design document