question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Null check syntax: `null` or `is`

See original GitHub issue

In 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mattbretlcommented, Mar 10, 2018

NULL and NOT_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: image

0reactions
mattbretlcommented, Mar 21, 2018

Agreed. The is: null would be a source of confusion, and I definitely prefer body: { isNull: true } over body: { null: true }. I’ll cut a release that includes isNull 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.)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found