Constructor
(protected) new PouchDBDataService(uuidopt, autocommitopt, optionsopt, additionalConnectorOptionsopt)
Constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
uuid |
string |
<optional> |
The UUID of the container. |
autocommit |
boolean |
<optional> |
Should this data service auto commit? |
options |
Object |
<optional> |
Optional options for PouchDB. |
additionalConnectorOptions |
Object |
<optional> |
Additional connector specific options for this transaction. |
- Source:
Methods
(static) createPouchDB(name, optionsopt) → {PouchDB}
Create a new instance of PouchDB.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of the PouchDB database. |
|
options |
Object |
<optional> |
Optional options for PouchDB. |
- Source:
Returns:
The new instance of PouchDB.
- Type
- PouchDB
(static) registerPouchDBPlugin(plugin)
Register the specified PouchDB plugin with PouchDB.
Parameters:
Name | Type | Description |
---|---|---|
plugin |
* | The PouchDB plugin to register. |
- Source:
clearCollection(id) → {Promise}
Remove all objects from the specified collection.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the collection. |
- Source:
Returns:
A promise that will be resolved when complete, or rejected
with an error.
- Type
- Promise
createCollection(id, forceopt) → {Promise}
Create a collection with the specified ID.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | The ID of the collection. |
|
force |
force |
<optional> |
force creation, don't check for existence first. |
- Source:
Returns:
A promise that will be resolved with a DataCollection
when complete, or rejected with an error.
- Type
- Promise
deleteCollection(id) → {Promise}
Delete a collection with the specified ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the collection. |
- Source:
Returns:
A promise that will be resolved when complete, or rejected
with an error.
- Type
- Promise
destroy() → {Promise}
Destroy the database.
- Source:
Returns:
A promise that will be resolved when destroyed, or
rejected with an error.
- Type
- Promise
executeQuery(queryString) → {Promise}
Execute a query across all objects stored in all collections, using a query
string that is dependent on the current Blockchain platform.
Parameters:
Name | Type | Description |
---|---|---|
queryString |
string | The query string for the current Blockchain platform. |
- Source:
Returns:
A promise that will be resolved with an array of objects
when complete, or rejected with an error.
- Type
- Promise
existsCollection(id) → {Promise}
Determine whether the collection with the specified ID exists.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the collection. |
- Source:
Returns:
A promise that will be resolved with a boolean
indicating whether the collection exists.
- Type
- Promise
(async) getCollection(id, bypass) → {Promise}
Get the collection with the specified ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the collection. |
bypass |
Boolean | bypass existence check |
- Source:
Returns:
A promise that will be resolved with a DataCollection
when complete, or rejected with an error.
- Type
- Promise
handleAction(actionFunction) → {Promise}
Handle an action against this data service. If auto commit is enabled, then
the action will be instantly executed. Otherwise it will be queued until the
transaction is prepared.
Parameters:
Name | Type | Description |
---|---|---|
actionFunction |
function | The function implementing the acyion. |
- Source:
Returns:
A promise that will be resolved when complete, or rejected
with an error.
- Type
- Promise
removeAllData() → {Promise}
Remove all the data
- Source:
Returns:
A promise that will be resolved when complete, or rejected
with an error.
- Type
- Promise
(async) transactionPrepare()
Called when a transaction is preparing to commit.
- Source:
(async) transactionStart(readOnly)
Called at the start of a transaction.
Parameters:
Name | Type | Description |
---|---|---|
readOnly |
boolean | Is the transaction read-only? |
- Source: