0.0.8 • Published 7 years ago

@smartcloud/datastore v0.0.8

Weekly downloads
8
License
Apache-2.0
Repository
github
Last release
7 years ago

@smartcloud/datastore

Google Cloud Datastore Module of SmartCloud Utility Library for Node.js

Methods are exposed through Javascript object called CloudDatastore

npm installation

$ npm install --save @smartcloud/datastore

Class

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.

Sample usage

const SmartCloudDatastore = require('@smartcloud/datastore');

var client = new SmartCloudDatastore.CloudDatastore({
    aggregateType: 'Foo',
    indexColumns: ['foo1', 'foo2']
});

Methods

  • 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

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago