You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2019/05/07 08:09:05 UTC
[couchdb-nano] branch master updated: Added types for
db.createIndex. Fixes #129 (#161)
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
The following commit(s) were added to refs/heads/master by this push:
new f74ce5c Added types for db.createIndex. Fixes #129 (#161)
f74ce5c is described below
commit f74ce5c5d9d16fe388ba36137ed0671adeb12f1f
Author: Lester Pérez <pr...@gmail.com>
AuthorDate: Tue May 7 10:08:59 2019 +0200
Added types for db.createIndex. Fixes #129 (#161)
* Added types for db.createIndex. Fixes #129
* Added field 'partitioned' to CreateIndexRequest
* Partitioned made optional
---
lib/nano.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/lib/nano.d.ts b/lib/nano.d.ts
index 4175bb1..0cdfdcb 100644
--- a/lib/nano.d.ts
+++ b/lib/nano.d.ts
@@ -182,6 +182,10 @@ declare namespace nano {
params: DocumentFetchParams,
callback?: Callback<DocumentFetchRevsResponse>
): Promise<DocumentFetchRevsResponse>;
+ // http://docs.couchdb.org/en/latest/api/database/find.html#db-index
+ createIndex(indexDef: CreateIndexRequest,
+ callback?: Callback<CreateIndexResponse>
+ ): Promise<CreateIndexResponse>;
multipart: Multipart<D>;
attachment: Attachment;
// http://docs.couchdb.org/en/latest/api/ddoc/render.html#get--db-_design-ddoc-_show-func
@@ -1269,6 +1273,42 @@ declare namespace nano {
// Total execution time in milliseconds as measured by the database.
execution_time_ms: number;
}
+
+ // http://docs.couchdb.org/en/latest/api/database/find.html#db-index
+ interface CreateIndexRequest {
+ // JSON object describing the index to create
+ index: {
+ // Array of field names following the sort syntax.
+ fields: SortOrder[],
+
+ // A selector to apply to documents at indexing time, creating a partial index.
+ partial_filter_selector?: MangoSelector
+ },
+
+ // Name of the design document in which the index will be created.
+ ddoc?: string
+
+ // Name of the index. If no name is provided, a name will be generated automatically.
+ name?: string,
+
+ // Can be "json" or "text". Defaults to json.
+ type?: 'json' | 'text',
+
+ // This field sets whether the created index will be a partitioned or global index.
+ partitioned?: boolean
+ }
+
+ // http://docs.couchdb.org/en/latest/api/database/find.html#db-index
+ interface CreateIndexResponse {
+ // Flag to show whether the index was created or one already exists. Can be “created” or “exists”.
+ result: string,
+
+ // Id of the design document the index was created in.
+ id: string,
+
+ // Name of the index created.
+ name: string
+ }
}
export = nano;