Optional condition value
See original GitHub issueHello,
I have some operators that doesn’t require a condition value (EXISTS, NOT EXISTS)
Could it be made optional ? I can pass value: null
but would be better to just not pass it at all. 👍
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Optional search condition in SQL Server - Stack Overflow
I am trying to create a query where when you do not input value in @date variable it will ...
Read more >Conditional optional checks - Using Swift
I have two optional properties and would like to know how to elegantly unwrap them to perform a conditional check.
Read more >std::optional - cppreference.com
The class template std::optional manages an optional contained value, i.e. a value that may or may not be present. A common use case...
Read more >Conditions - AWS CloudFormation
The optional Conditions section contains statements that define the circumstances under which entities are created or configured.
Read more >Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining ( ?. ) operator accesses an object's property or calls a function. If the object accessed or function called is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jgoux Sorry for the delayed response; I’ve been busy.
I see your point, and I think it’s a good one. There’s a couple considerations we’d need to think about and investigate before this change could be implemented:
value
prop is not provided, is that most likely due to programmer error (a bug)? If so, does value of allowing undefined properties outweight the cost of allowing devs to potentially shoot themselves in the foot?For now your best bet is to simply add those explicit
null
s, which it sounds like you’ve already done.This is what I actually use to define my
exists
andnot exists
operators. The thing is I don’t need thejsonValue
part, because the operator is opering only on thefactValue
. It’s just something like :factValue => factValue !== undefined
.So the logic would be to not have to specify a value key in the condition, but if I omit it, it raises an error about it.