Giter Site home page Giter Site logo

Comments (3)

tgriesser avatar tgriesser commented on April 29, 2024

Yep - at one point I had something for this where you could do:

userTreed.save({state: 'committed'}, {patch: true})

but then I ended up removing it in favor of saving the entire model - I forget why, but I think I had a reason at the time.

Anyway, since having done that, I've found that it'd be useful to have this functionality... but I was thinking of renaming the option sent to partial: true just so it's not confusing. Does that seem like it'd make sense?

from bookshelf.

kubino avatar kubino commented on April 29, 2024

Hi Tim, I think both scenarios are useful in some situations. Having a simple switch (dirty check/entiry update) would be probably the best solution, but might be tricky to implement. So being explicit like this userTreed.save({state: 'committed'}, {partial: true}) is quite fine for me...

Not really sure about naming conventions :) Partial make sense, you can maybe use enumeration instead of bool. Something like updateMode - default(row) / manual / dirtyCheck ....

best
Jakub

from bookshelf.

tgriesser avatar tgriesser commented on April 29, 2024

Hey @kubino - this should now be possible in 0.3.0 with the {patch: true} method:

userTreed.save({state: 'committed'}, {patch: true});

or

userTreed.save(userTreed.changed, {patch: true});

...if you only want to update the changed properties in the model. For now, I'm going to keep the options flags as simple as I can, so there's not too many features to support off the bat, especially when they're not too difficult to implement yourself. Hope this works!

from bookshelf.

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.