Skip to content

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

@Dzieni

Description

@Dzieni

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)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions