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

Add type::is::nil function #3989

Closed
wants to merge 1 commit into from
Closed

Conversation

Odonno
Copy link
Contributor

@Odonno Odonno commented May 6, 2024

Thank you for submitting this pull request! We really appreciate you spending the time to work on these changes.

What is the motivation?

Add a simple way to check for nullable (not truthy) values.
Note: can be useful for building an ORM.

What does this change do?

Before:

WHERE (value != NONE AND value != null);

After:

WHERE !type::is::nil(value);

What is your testing strategy?

Unit tests

Is this related to any issues?

N/A

Does this change need documentation?

Have you read the Contributing Guidelines?

@Odonno Odonno requested review from a team and tobiemh as code owners May 6, 2024 16:44
@Odonno Odonno force-pushed the feat/is-nil-function branch 5 times, most recently from c58f255 to 6ba1341 Compare May 7, 2024 21:31
phughk
phughk previously approved these changes May 13, 2024
Copy link
Contributor

@phughk phughk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loving these PRs, thanks!

@phughk phughk added this pull request to the merge queue May 23, 2024
@kearfy kearfy removed this pull request from the merge queue due to a manual request May 23, 2024
@tobiemh
Copy link
Member

tobiemh commented Jun 11, 2024

Hi @Odonno thanks for this PR 🎉 ! I've had a proper think about this, and in conclusion, although it does save a little bit of writing, the introduction of this function could be unclear for a number of reasons:

  • All of the type::is functions are actual types in SurrealDB. type::is::nil() implies that there is a nil type in the database.
  • Languages like Golang have a nil keyword, which might be confusing to users, especially given that there are already NONE and NULL types in SurrealDB.

As a result, I'm going to close this PR, but if you have any additional ideas, then do let me know in a separate issue or pull request!

@tobiemh tobiemh closed this Jun 11, 2024
@Odonno Odonno deleted the feat/is-nil-function branch June 11, 2024 17:06
@Odonno
Copy link
Contributor Author

Odonno commented Jun 11, 2024

Hello Tobie. This is a valid argument. I will try to find a better name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants