Replies: 1 comment
-
|
Looks like you can easily write a helper function for yourself that produces such a query? Other than that, such a query is too verbose to consider a generic implementation. It is way more complex than the queries produced by this library. The extras it has, on top of what other query generators use:
And that's too much to consider adding it. One piece that perhaps could be considered - adding In all, I have to assign it a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Since version 15, PG supports
MERGE INTO. I managed to use this library for such query, but I was missing some of the helpers that are available forinsert on conflict, for example.This is more or less what I came up with (
primaryKeysandcolumnsare instances ofColumnSet):from which I distill the following suggestions for ColumnSet:
.joinColumns({from: 'y', to: 'x'})or.assignColumns({from: 'y', sep: 'AND'})to replace.columns.map(c => `x.${c.escapedName} = y.${c.escapedName}`).join(' AND ').names({from: 'y'})or.assignValues({from: 'y'})to replace.columns.map(c => `y.${c.escapedName}`).join(',')These are just examples, of course, and any more profound support for MERGE INTO similar to
pgp.helpers.insert()would be even nicer. WDYT?Beta Was this translation helpful? Give feedback.
All reactions