Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Promise-returning methods #11

Closed
lostpebble opened this issue Sep 7, 2016 · 3 comments
Closed

Optional Promise-returning methods #11

lostpebble opened this issue Sep 7, 2016 · 3 comments

Comments

@lostpebble
Copy link

Hi,

Love what's been done here, this is just the kind of thing I've been looking for after moving from Java (using the objectify library for Google datastore) into Javascript Node development and finding the implementation a bit bare-bones in the base google-cloud library. The schema and model concepts really make it easy to work with.

The only thing I'd really love to see added is the option of having Promises returned instead of using callbacks (on the relevant such methods), such as the Model methods get, updated, delete etc. It could be added using a different name such as BlogPost.getAsync(1234). I like to make use of async functions and combined with promises it makes things amazingly easy to reason about.

For now I'll have to wrap all the base methods in Promises myself, but would be nice to have it out the box.

@sebelga
Copy link
Owner

sebelga commented Sep 8, 2016

Hi @lostpebble, thanks for the lovely feedback!

I am currently in a big change professionally, but as soon as I settle I will consider what you comment here. You're right, Promise could be a great feature, I will also consider Generator functions.

Cheers.

@sebelga
Copy link
Owner

sebelga commented Nov 15, 2016

Hi, happy to announce that v0.8.0 support Promises. It's a big refactor so let me know if there are any regression. thanks!

@sebelga sebelga closed this as completed Nov 15, 2016
@lostpebble
Copy link
Author

lostpebble commented Nov 16, 2016

Great stuff! Thanks for that! I'll have to take a look into it. Does it change all the default methods to run promises, or are there now optional promise returning methods?

EDIT: Nevermind, I see that the callback is now optional and will return promises if not included. Nice way to go about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants