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

How to define different setter for update and insert? #17

antage opened this Issue Mar 21, 2013 · 5 comments


None yet
5 participants

antage commented Mar 21, 2013

I want to increment table field (by UPDATE) or set to 1 (by INSERT if record doesn't exist).
How can I do that with upsert?


This comment has been minimized.


seamusabshere commented Mar 21, 2013

upsert can't do that, yet... it's on the wishlist.

I imagine it might work something like:

selector = { id:15 }
setter = { count: Upsert.sql('count + 1') } # here's the important part
upsert.row(selector, setter)

would that work for you?


This comment has been minimized.

antage commented Mar 21, 2013

I see it like this:

selector = { id: 15 }
update_setter = { count: Upsert.sql('count + 1') }
insert_setter = { count: 1 }
upsert.row_with_two_setter(update_setter, insert_setter, selector)

This comment has been minimized.

jan commented May 22, 2015

Can anyone sketch a solution for this?


This comment has been minimized.

ioquatix commented Feb 18, 2017

Is this possible yet?


This comment has been minimized.


pnomolos commented Mar 31, 2017

@ioquatix It's not possible yet, this is still definitely on the wishlist.

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