Null check syntax: `null` or `is`
See original GitHub issueIn the alpha releases, null checks were performed by:
body: { null: true }
or body: { null: false }
In the first beta release, I added an is
operator to allow:
body: { is: NULL }
or body: { is: NOT_NULL }
I only want to support one or the other in v1.0.0. My preference is the is
operator, as I think it’s easier to read inside complex queries. Anyone else have a preference?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
and ??= operators - null-coalescing operators - Microsoft Learn
The null-coalescing operator ?? returns the value of its left-hand operand if it isn't null ; otherwise, it evaluates the right-hand operand ...
Read more >C#: Different ways to Check for Null - Thomas Claudius Huber
= operator overloads on the specific class. It will do a null check, no matter if there's an operator overload or not. That...
Read more >Nullish coalescing operator (??) - JavaScript - MDN Web Docs
The nullish coalescing (??) operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null ......
Read more >SQL NULL Values - IS NULL and IS NOT NULL - W3Schools
The IS NULL operator is used to test for empty values (NULL values). The following SQL lists all customers with a NULL value...
Read more >Check for Null/Not Null with is null and is { } - IntelliTect
This syntax works with C# 8.0's static analysis, so later code will know that variable has been checked for null. Checks if the...
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 Free
Top 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
NULL
andNOT_NULL
are GraphQLEnumType values. When making a query without variables, you use the enum value within the query as shown above. When making a query with variables, you use the string representation of the enum as shown below:Agreed. The
is: null
would be a source of confusion, and I definitely preferbody: { isNull: true }
overbody: { null: true }
. I’ll cut a release that includesisNull
and plan to remove the other two at v1.0.0. (Wish I could actually mark them deprecated, but GraphQL doesn’t support deprecating input fields AFAIK.)