Skip to content
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

Update JoinRaw bindings type to accept arrays #4752

Merged
merged 3 commits into from Oct 20, 2021
Merged

Update JoinRaw bindings type to accept arrays #4752

merged 3 commits into from Oct 20, 2021

Conversation

RyWilliams
Copy link
Contributor

This extends the bindings in the JoinRaw type to accept arrays.

Example use case in postgres:

knex('table').joinRaw(
  `join (
    SELECT id
    FROM joined_table jt
    WHERE jt.id = ?
    AND jt.value = ANY(?)
  ) AS j ON j.id = t.id`,
  [123, ['value one', 'value two']],
);

@maximelkin
Copy link
Collaborator

Can you also add this in typings tests? into test-tsd/select.test-d.ts

Also, this interface looks similar to RawQueryBuilder, but joinRaw can't accept Raw instance (in js code and in typings).

@kibertoad .joinRaw() accepting Raw instance looks more consistent, what do you think?

@RyWilliams RyWilliams marked this pull request as ready for review October 20, 2021 02:47
@kibertoad
Copy link
Collaborator

Yes, would be great to accept it there. Should be fairly simple too.

@kibertoad kibertoad merged commit 3e53c03 into knex:master Oct 20, 2021
@RyWilliams RyWilliams deleted the RyWilliams-patch-1 branch October 21, 2021 02:47
OlivierCavadenti pushed a commit to AbeonaPascha/knex that referenced this pull request Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants