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

feature: optional filters #4

Open
nicoabie opened this issue Oct 23, 2023 · 0 comments
Open

feature: optional filters #4

nicoabie opened this issue Oct 23, 2023 · 0 comments

Comments

@nicoabie
Copy link
Contributor

One cool thing about current ORMs out there is the ability to have optional filters

in sequelize something like:

model.find({where: {
  ...(someContidion && {someField: someValue})
});

in ojotas we could so something similar when writing sql

select * from user where name = :name and status = :status?

that should generate a type that has name as required and status as optional. if status is not provided, the AND statament should be transformed to remove that condition.

one could say that instead of removing the status condition it could be transformed to status = status. but that would only work for ANDs and not ORs so it is safer to always remove it if nor provided

@nicoabie nicoabie assigned nicoabie and unassigned nicoabie Nov 7, 2023
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

No branches or pull requests

1 participant