-
Notifications
You must be signed in to change notification settings - Fork 90
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
Allow a NULL
tags property to be nil
when read from the database
#44
Conversation
e769a32
to
d53ff7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor potential differences:
1.Does this alter the behavior of json serializing a Job if the user chooses to do that for some reason? Say for error reporting as part of a payload to a bug tracker, or some other instrumentation. Do we care or should we have coverage for this?
2. Does this in any way affect APIs that subsequently use a job with nil tags? I think the answer is “no” because tags aren’t ever written back to the database after initial job insertion, but wanted to confirm.
3. The only other impact I could think of is any consumers downstream of a subscription might see a different result after this change and poorly written ones might somehow have an issue, but this isn’t a concern as of this initial release.
I think my conclusion is that we should move forward with this but wanted to confirm your thoughts on the above.
d53ff7d
to
8adb0e2
Compare
This one's so tiny that it's minutiae, but as I was looking at the null-ability of various job row fields today while implementing Ruby, I realized that it doesn't really seem necessary to be marshaling a `NULL` tags value to an empty `[]string{}` slice. In Go, `[]string{}` and `[]string(nil)` are functionally identical in every way that I can think of (`append` on `nil` works, `len` on `nil` works), so I think it makes sense just to avoid the allocation and reflect what the database's actual value is. [1] https://go.dev/tour/moretypes/15
8adb0e2
to
b188145
Compare
Yeah it would — the
I don't think so because as noted, behavior of
Yep +1. That's why I want to make sure to lock changes like this in early — although minor, I'd still consider this a breaking change later on because it's possible to write code that'd be broken. |
BTW I should've mentioned: The other strong contender here is to make tags I don't mind this way either and almost went this route (tend to prefer Let me know your thoughts on that. Going to merge this for now in the interest of cutting a release, but happy to change to that too. |
I kinda like that as it will enforce consistency in all clients without requiring special handling in some languages. I can PR that later today. |
Cool. Works for me. |
This one's so tiny that it's minutiae, but as I was looking at the
null-ability of various job row fields today while implementing Ruby, I
realized that it doesn't really seem necessary to be marshaling a
NULL
tags value to an empty
[]string{}
slice. In Go,[]string{}
and[]string(nil)
are functionally identical in every way that I can thinkof (
append
onnil
works,len
onnil
works), so I think it makessense just to avoid the allocation and reflect what the database's
actual value is.
[1] https://go.dev/tour/moretypes/15