-
Notifications
You must be signed in to change notification settings - Fork 863
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
Include the field name in error messages when scanning structs #2225
base: master
Are you sure you want to change the base?
Conversation
c5511eb
to
bdd990b
Compare
The idea of including the column header is reasonable. But just the column name in parenthesis seems like it could be ambiguous. I could see people mistaking that for the name of the variable they are attempting to scan into (even though that's not actually possible in Go). Not sure what else to do without making the error message too long though. Beyond that, why use a The tests would need to be fixed as well. |
yep, i could change the error to append `(col: <name>)`
I'll get the tests fixed up, *string was there b/c i initially thought the
error struct was more widely used, but it's not, so ill change it back.
…On Sat, Jan 11, 2025, 11:21 AM Jack Christensen ***@***.***> wrote:
The idea of including the column header is reasonable. But just the column
name in parenthesis seems like it could be ambiguous. I could see people
mistaking that for the name of the variable they are attempting to scan
into (even though that's not actually possible in Go). Not sure what else
to do without making the error message too long though.
Beyond that, why use a *string for field name instead of just a string?
That leaves the possibility for nil as well as pinning the whole field
descriptions slice in memory.
The tests would need to be fixed as well.
—
Reply to this email directly, view it on GitHub
<#2225 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAASJJNHJL2HIZGFVVNSDLD2KFAKNAVCNFSM6AAAAABU4SPLZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBVGMZDEOJVGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
bdd990b
to
69b44c3
Compare
@jackc i've updated the code & tests, one test is failing locally but it looks related to my timezone settings and not the changes I'm proposing.
|
69b44c3
to
d686ebb
Compare
d686ebb
to
9c0ad69
Compare
this may be a bit painful to get through, I'm not sure how to run the full suite locally, so, i can only see test failures here. I'll make updates as I see errors coming though. Is there a way for me to run the test suite in my github account w/out needing to wait for you to press the button? |
alright, i was able to get the cockroach db tests running, i see failures but seem to be unrelated to the changes in this PR
|
This is helpful when the order of the columns in the row is unknown (e.g. when issuing a
select *
query).