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

Allow searching for IS (NOT) NULL in default column settings #15

Open
Dzieni opened this issue Jan 25, 2022 · 0 comments
Open

Allow searching for IS (NOT) NULL in default column settings #15

Dzieni opened this issue Jan 25, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Dzieni
Copy link
Contributor

Dzieni commented Jan 25, 2022

Simple columns like fooBar: {path: 'foo.bar'} could work in a following way:

import {IS_NULL, IS_NOT_NULL} from 'strato-db'

// to search for equality
await model.search({fooBar: 'BAZ'})

// to search for null foo.bar
await model.search({fooBar: IS_NOT_NULL})

// to search for non-null foo.bar
await model.search({fooBar: IS_NULL})

If you implement your own where as a string, then using those symbols would throw.
If you implement your own where as a function, then you are responsible for handling those symbols by yourself.

Thanks to that:

  • you have consistent naming in all the projects (with custom columns for null/not null you have a lot of naming conventions to choose => easy to lose consistency)
  • code is more DRY

Having such an option should also reduce the need of using where as a function, which is very welcome (where as a function has no easy option to prepare statements)

@Dzieni Dzieni self-assigned this Jan 25, 2022
@Dzieni Dzieni added the enhancement New feature or request label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant