C# Class NDB.RemoteDB

A simple wrapper class for the CouchDB HTTP API. No initialisation is necessary, just create an instance and call the appropriate methods to interact with CouchDB. All methods throw exceptions when things go wrong.
Afficher le fichier Open project: Kirosoft/NouchDB Class Usage Examples

Méthodes publiques

Méthode Description
BatchGetDocs ( string server, string db, string content ) : string

Create a new document. If the document has no ID field, it will be assigned one by the server.

CountDocuments ( string server, string db ) : int

Get the document count for the given database.

CreateDatabase ( string server, string db ) : void

Create a new database.

CreateDocument ( string server, string db, string content ) : void

Create a new document. If the document has no ID field, it will be assigned one by the server.

DeleteDatabase ( string server, string db ) : void

Delete a database

DeleteDocument ( string server, string db, string docid ) : void

Delete a document.

ExecTempView ( string server, string db, string map, string reduce, string startkey, string endkey ) : string

Execute a temporary view and return the results.

GetAllDocuments ( string server, string db ) : NDB.DocInfo[]

Get information on all the documents in the given database.

GetChanges ( string server, string db, bool includeDocs = false, long since ) : JsonData

Get all changes from the database since a given change revision

GetDatabases ( string server ) : string[]

Get a list of database on the server.

GetDocument ( string server, string db, string docid ) : string

Get a document.

GetDocument ( string server, string db, string docid, string startkey, string endkey ) : string

Get a document.

RemoteDB ( ) : System

Private Methods

Méthode Description
DoRequest ( string url, string method ) : string

Internal helper to make an HTTP request and return the response. Throws an exception in the event of any kind of failure. Overloaded - use the other version if you need to post data with the request.

DoRequest ( string url, string method, string postdata, string contenttype ) : string

Internal helper to make an HTTP request and return the response. Throws an exception in the event of any kind of failure. Overloaded - use the other version if no post data is required.

Method Details

BatchGetDocs() public méthode

Create a new document. If the document has no ID field, it will be assigned one by the server.
public BatchGetDocs ( string server, string db, string content ) : string
server string The server URL
db string The database name
content string The document contents (JSON).
Résultat string

CountDocuments() public méthode

Get the document count for the given database.
public CountDocuments ( string server, string db ) : int
server string The server URL
db string The database name
Résultat int

CreateDatabase() public méthode

Create a new database.
public CreateDatabase ( string server, string db ) : void
server string The server URL
db string The database name
Résultat void

CreateDocument() public méthode

Create a new document. If the document has no ID field, it will be assigned one by the server.
public CreateDocument ( string server, string db, string content ) : void
server string The server URL
db string The database name
content string The document contents (JSON).
Résultat void

DeleteDatabase() public méthode

Delete a database
public DeleteDatabase ( string server, string db ) : void
server string The server URL
db string The name of the database to delete
Résultat void

DeleteDocument() public méthode

Delete a document.
public DeleteDocument ( string server, string db, string docid ) : void
server string The server URL
db string The database name
docid string The document ID.
Résultat void

ExecTempView() public méthode

Execute a temporary view and return the results.
public ExecTempView ( string server, string db, string map, string reduce, string startkey, string endkey ) : string
server string The server URL
db string The database name
map string The javascript map function
reduce string The javascript reduce function or /// null if not required
startkey string The startkey or null not to use
endkey string The endkey or null not to use
Résultat string

GetAllDocuments() public méthode

Get information on all the documents in the given database.
public GetAllDocuments ( string server, string db ) : NDB.DocInfo[]
server string The server URL
db string The database name
Résultat NDB.DocInfo[]

GetChanges() public méthode

Get all changes from the database since a given change revision
public GetChanges ( string server, string db, bool includeDocs = false, long since ) : JsonData
server string The server URL
db string The database name
includeDocs bool
since long sequence number for the last checkpoint, defaults to 0 i.e. all changes
Résultat LitJson.JsonData

GetDatabases() public méthode

Get a list of database on the server.
public GetDatabases ( string server ) : string[]
server string The server URL
Résultat string[]

GetDocument() public méthode

Get a document.
public GetDocument ( string server, string db, string docid ) : string
server string The server URL
db string The database name
docid string The document ID.
Résultat string

GetDocument() public méthode

Get a document.
public GetDocument ( string server, string db, string docid, string startkey, string endkey ) : string
server string The server URL
db string The database name
docid string The document ID.
startkey string The startkey or null not to use
endkey string The endkey or null not to use
Résultat string

RemoteDB() public méthode

public RemoteDB ( ) : System
Résultat System