C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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.

Описание методов

BatchGetDocs() публичный Метод

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).
Результат string

CountDocuments() публичный Метод

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
Результат int

CreateDatabase() публичный Метод

Create a new database.
public CreateDatabase ( string server, string db ) : void
server string The server URL
db string The database name
Результат void

CreateDocument() публичный Метод

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).
Результат void

DeleteDatabase() публичный Метод

Delete a database
public DeleteDatabase ( string server, string db ) : void
server string The server URL
db string The name of the database to delete
Результат void

DeleteDocument() публичный Метод

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.
Результат void

ExecTempView() публичный Метод

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
Результат string

GetAllDocuments() публичный Метод

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
Результат NDB.DocInfo[]

GetChanges() публичный Метод

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
Результат LitJson.JsonData

GetDatabases() публичный Метод

Get a list of database on the server.
public GetDatabases ( string server ) : string[]
server string The server URL
Результат string[]

GetDocument() публичный Метод

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.
Результат string

GetDocument() публичный Метод

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
Результат string

RemoteDB() публичный Метод

public RemoteDB ( ) : System
Результат System