v0.5.0
·
861 commits
to main
since this release
⚠️ Breaking Changes
Promises have arrived!
It's been a long time coming, but we're finally here. We've shipped promise support in the Google Cloud Datastore module!
Do I have to use promises?
Nope, carry on. (But keep reading if you use streams)
How do I use promises?
Don't pass a callback:
var datastore = require('@google-cloud/datastore')();
var query = datastore.createQuery('Kind');
query.run()
.then(function(data) {
var entities = data[0];
})
.catch(function(err) {});
How do I use a method as a stream?
All of the streaming functionality from our methods have been moved to their own method.
var datastore = require('@google-cloud/datastore')();
- datastore.get()
+ datastore.createReadStream()
.on('data', function(entity) {})
- datastore.runQuery()
+ datastore.runQueryStream()
.on('data', function(entity) {})
var transaction = datastore.transaction('transaction-id');
- transaction.get()
+ transaction.createReadStream()
.on('data', function(entity) {})
- transaction.runQuery()
+ transaction.runQueryStream()
.on('data', function(entity) {})
var query = datastore.createQuery('Kind');
- query.run()
+ query.runStream()
.on('data', function(entity) {})