clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

Is there any plan to add promisified versions? #87

Closed nolde closed 7 years ago

nolde commented 7 years ago

Are there any plans to add promise support in future releases? There are packages that help with that, allowing dual support for node callback pattern and promises.

Account.create([item1, item2, item3], function (err, acccounts) {
  console.log('created 3 accounts in DynamoDB', accounts);
});
// or
Account.create([item1, item2, item3]).then(function (acccounts) {
  console.log('created 3 accounts in DynamoDB', accounts);
}).catch(function (err) {
  console.error(err);
});
BlogPost
  .query('werner@example.com')
  .where('title').beginsWith('Expanding')
  .exec(callback);
// or
BlogPost
  .query('werner@example.com')
  .where('title').beginsWith('Expanding')
  .exec()
  .then(thenCallback, catchCallback);

Some of those packages are hybridify and polygoat, and packages like any-promise would allow flexibility of implementation choice.

clarkie commented 7 years ago

Dupe of #82

I'd be happy to look at a PR. It may be simpler to pull dynogels-promisified inside here instead for now?