-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Support for UPDATE SET ... FROM (VALUES ...) pattern #527
Comments
Just in case - I edited the example/wording as it wasn't originally as clear. |
I think this produces what you want? (sql/format {:update :membership
:set {:last-active-at :new-values.last-active-at}
:from [[{:values [[1 2 3]
[4 5 6]]}
[:new-values [:composite :last-active-at :user-id :team-id]]]]
:where [:and
[:= :membership.user-id :new-values.user-id]
[:= :membership.team-id :new-values.team-id]]}) |
Certainly - thanks much! I had searched for a similar construction in clause-reference.md and I also noticed now that :composite has no test coverage - perhaps good chance to kill two birds with one stone? |
Probably because I didn't know such a syntactic construct was possible. I've added the "documentation" tag to add an example in the clause reference.
I've added the "needs test" tag to remind me to add some tests for it (but it's a pretty trivial syntax expansion). |
Thanks, Sean! |
Signed-off-by: Sean Corfield <[email protected]>
Awesome! That seems easily grepable for anyone checking out the repo. |
Today I found using myself a pattern for which honeysql support wasn't immediately apparent:
The intent of such queries is that the parameters can combine "what to persist" with "what to query".
(In specific terms:
new_values.last_active_at
is something to persist,new_values.user_id
/new_values.team_id
is something to query)Is this something trivially obtainable with Honey as-is, or would it need some adaptation?
I gave it a few attempts, to no avail.
Thanks - V
The text was updated successfully, but these errors were encountered: