-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat: add HandleEmtpyInListsPlugin. #925
Merged
igalklebanov
merged 14 commits into
kysely-org:v0.28
from
austinwoon:feat/safe-empty-where-in-plugin
Dec 15, 2024
Merged
feat: add HandleEmtpyInListsPlugin. #925
igalklebanov
merged 14 commits into
kysely-org:v0.28
from
austinwoon:feat/safe-empty-where-in-plugin
Dec 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
igalklebanov
added
enhancement
New feature or request
built-in plugin
Related to a built-in plugin
labels
Mar 30, 2024
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
src/plugin/safe-empty-array-where-in/safe-empty-array-where-in.transformer.ts
Outdated
Show resolved
Hide resolved
igalklebanov
force-pushed
the
feat/safe-empty-where-in-plugin
branch
from
December 14, 2024 12:00
62618ed
to
b169551
Compare
Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com>
Open in Stackblitz • kysely_koa_example
commit: |
igalklebanov
changed the title
feat: add safe empty where in plugin
feat: add HandleEmtpyInListsPlugin.
Dec 15, 2024
Went over it and expanded the use case. You can choose which strategy to apply and there are 2 built-in strategies to choose from and support for custom ones. This'll probably land in v0.28! 🥳 |
igalklebanov
added a commit
that referenced
this pull request
Jan 5, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
igalklebanov
added a commit
that referenced
this pull request
Jan 9, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
igalklebanov
added a commit
that referenced
this pull request
Jan 11, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
igalklebanov
added a commit
that referenced
this pull request
Jan 12, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
igalklebanov
added a commit
that referenced
this pull request
Jan 17, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
igalklebanov
added a commit
that referenced
this pull request
Jan 19, 2025
* feat: empty where in plugin * test: add new tests * chore: remove unneccesary typeguards * fix: change to binary operator node * test: update tests to do both in and not in * test: for having * chore: rm test * test: nullable tests * chore: nit * chore: condense suite * chore: db config override * chore: extra console log * chore: empty arr plugin docs * HandleEmptyInListsPlugin initial commit. Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com> --------- Co-authored-by: Austin Woon <austin@open.gov.sg> Co-authored-by: igalklebanov <igalklebanov@gmail.com> remove only.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey 👋
closes #709.
This PR was created initially by @austinwoon, and revisited/expanded by @igalklebanov.
It adds
HandleEmptyInListsPlugin
to allow you to handlein ()
andnot in ()
with a chosen strategy.It ships with 2 strategies out-the-box:
replaceWithNoncontingentExpression
- Replacesin ()
with1 = 0
andnot in ()
with1 = 1
- the strategy used by Knex.js, PrismaORM, Laravel and SQLAlchemy.pushValueIntoList(uniqueValue: string)
- Replacesin ()
within (null)
- the strategy used by TypeORM and Sequelize, andnot in ()
withcast({{leftOperand}} as char) in ('{{uniqueValue}}')
.It also supports custom strategies, e.g.:
in (null)
and1 = 1
.