You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disclaimer: This might be me simply misunderstanding the intent of isNullish. I'm still deep diving the values implementation.
Currently, isNullish attempts to determine whether a value is a zero-value (in the case of values), or nil (in the case of pointers). This mostly works in its current form, but misses several cases. For example, *time.Time per this playground.
While digging into this, I came to a very sloppy implementation [while hacking this problem out] that involves reflect. To me, this makes more sense. However, despite substantial use of the empty interface, this library often times in cases like this forgoes reflect in favor of type assertions. Is there a technical reason for that? Or, simply an approach that worked initially, but hasn't evolved as the library grew?
At any rate, please let me know if I'm misunderstanding the intent of isNullish. Similarly, if moving this implementation over to one based on reflect is okay for the community, I'm happy to tidy up what I have here and open a pull request.
The text was updated successfully, but these errors were encountered:
Okay, and now of course after spending a decent amount of time here, I'm realizing after taking a breather that this is just a scalar implementation issue. The type assertions over empty interface are valid because the GraphQL types are of limited scope, making it clean. What I'm missing here is a time scalar that converts this to one of the relevant GraphQL types.
No worries on that, there is at least one highly known issue with isNullish and that is that "" is considered null when (according to the issue/PR`) is definitely not the desired value.
Uh oh!
There was an error while loading. Please reload this page.
Disclaimer: This might be me simply misunderstanding the intent of isNullish. I'm still deep diving the values implementation.
Currently,
isNullish
attempts to determine whether a value is a zero-value (in the case of values), or nil (in the case of pointers). This mostly works in its current form, but misses several cases. For example,*time.Time
per this playground.While digging into this, I came to a very sloppy implementation [while hacking this problem out] that involves
reflect
. To me, this makes more sense. However, despite substantial use of the empty interface, this library often times in cases like this forgoesreflect
in favor of type assertions. Is there a technical reason for that? Or, simply an approach that worked initially, but hasn't evolved as the library grew?At any rate, please let me know if I'm misunderstanding the intent of
isNullish
. Similarly, if moving this implementation over to one based onreflect
is okay for the community, I'm happy to tidy up what I have here and open a pull request.The text was updated successfully, but these errors were encountered: