Giter Club home page Giter Club logo

Comments (4)

adrianpraja avatar adrianpraja commented on August 17, 2024

Hi Maria,

It's in my todo list, It should not be difficult to add
just like you said by not passing the callback.

The main concern is that it may create braking changes.

Even myself I've used this library without passing a callback
knowing that it wont throw an error if it fails
(for example when incrementing stats).

Now, in a promise world, I should add the .catch()
wherever I've not passed a callback.

I'm also considering

DynamoDB
	.table(...)
	.insert(...)
	.on('err',...)
	.on('data',...)
	.on('duplicate',...)

or

DynamoDB
	.table(...)
	.scan(...)
	.each( callback )

but Promise seems more widely adopted


I guess Promise may be coming soon :)

from dynamodb-oop.

damonmaria avatar damonmaria commented on August 17, 2024

Sounds good. I was thinking through how I would do this and thought that the internal callbacks, if broken down into 'onError', 'transformData', etc., could be applied to either the promise then() or the callback. As is with multiple functionality (including the calling the caller's callback) wrapped up in the internal callbacks it's just not possible.

Ever since moving to async/await world I always try and develop with promises now since it's so much less error prone.

from dynamodb-oop.

adrianpraja avatar adrianpraja commented on August 17, 2024

I've added Promise for .get() .query() and .scan() using the "promise" npm

DynamoDB
	.table(...)
	.where(...).eq(...)
	.query()
	.then(success_cb, fail_cb)
	.catch(fail_cb)

If you;re still using the library please let let me know if you see any issues
using it.

It is a test release , my tests shows that it does not break existing functionality,
it is not documented yet, the rest of the functionality should get Promise() soon

from dynamodb-oop.

adrianpraja avatar adrianpraja commented on August 17, 2024

Im closing this as the last release includes unpromised Promises :-)

from dynamodb-oop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.