Skip to content

Add setRef to UpdateTableBuilder. #1413

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

Open
igalklebanov opened this issue Apr 5, 2025 · 1 comment
Open

Add setRef to UpdateTableBuilder. #1413

igalklebanov opened this issue Apr 5, 2025 · 1 comment
Labels
api Related to library's API enhancement New feature or request greenlit Ready for implementation

Comments

@igalklebanov
Copy link
Member

igalklebanov commented Apr 5, 2025

Hey 👋

Currently, to refer to an existing column in query context, you either:

.set('target', (eb) => eb.ref('source'))

or:

.set((eb) => ({
  target: eb.ref('source'),
}))

Proposal:

Add setRef to UpdateQueryBuilder to allow:

.setRef('target', 'source')

and perhaps even:

.setRef({
  target: 'source',
})

...for use cases where all/most values are coming from referenced columns.

We should always look to provide ways not to use ExpressionBuilder if you're only referencing columns - callbacks are expensive at compile-time, and the query becomes less readable and harder to type.

@igalklebanov igalklebanov added api Related to library's API enhancement New feature or request labels Apr 5, 2025
@koskimas
Copy link
Member

koskimas commented Apr 6, 2025

Makes sense!

@koskimas koskimas added the greenlit Ready for implementation label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request greenlit Ready for implementation
Projects
None yet
Development

No branches or pull requests

3 participants
@koskimas @igalklebanov and others