Google Datastore Module of SmartCloud Utility Library for Node.js
npm install @smartcloud/datastoreGoogle Cloud Datastore Module of SmartCloud Utility Library for Node.js
Methods are exposed through Javascript object called CloudDatastore
sh
$ npm install --save @smartcloud/datastore
`$3
The module has core class named "CloudDatastore". To initialize an CloudDatastore object, pass the follow parameters.
* aggregateType - (required) specify aggregateType which is also used as target EntityKind in Google cloud datastore.
* maxRetries - (optional) specify maximum number of times that process can retry in case of failure. If not specified, default will be 10.
* indexColumns - (optional) specify array of property names which need to be indexed.
$3
`js
const SmartCloudDatastore = require('@smartcloud/datastore');var client = new SmartCloudDatastore.CloudDatastore({
aggregateType: 'Foo',
indexColumns: ['foo1', 'foo2']
});
``datastoreKey(keyOptions) method* - Return Google datastore key based on keyOptions given. For keyOptions structure, follow Google datastore key.
datastore() method* - Return current datastore instance associated with current CloudDatastore instance
convertObjectToUnindexedData() method* - Unindex all the properties of the object targeted to persist in Google datastore excluding properties specified through indexColumns during CloudDatastore object initialization
saveRecord(entity, path) method* - Save specified entity into Google datastore.
queryDatastore(query) method* - Run Google datastore query
loadFromDatastore(key) method* - Get object from Google datastore
deleteFromDatastore(key) method* - Delete object from Google datastore
saveRecords(entities) method* - Save multiple entities into Google datastore