Skip to content

fix(spanner): SelectAll struct fields match should be case-insensitive#9417

Merged
rahul2393 merged 3 commits intomainfrom
fix_spanner_select_all
Feb 13, 2024
Merged

fix(spanner): SelectAll struct fields match should be case-insensitive#9417
rahul2393 merged 3 commits intomainfrom
fix_spanner_select_all

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

Fixes: #9415

row.ToStruct does case-insensitive match against the Go struct field names using https://pkg.go.dev/cloud.googles.ltd/go/internal/fields#List.Match, others decode methods should also follow the same

@rahul2393 rahul2393 requested review from a team February 13, 2024 14:39
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the Spanner API. labels Feb 13, 2024
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2024
want: &[]testStruct{
{Col1: 1, Col2: 1.1, Col3: "value", Col4: tm},
{Col1: 2, Col2: 2.2, Col3: "value2", Col4: tm.Add(24 * time.Hour)},
{Col1: 1, COL2: 1.1, Col3: "value", Col4: tm},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here also: Should this not be kept as Col2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, this should be COL2, because testStruct is user defined struct and we are asserting that though mock response contained col2 it was successfully decoded in testStruct

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Eh, yeah, I read that wrong. I thought that this was also a mock iterator, but it's clearly not....

@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API. kokoro:force-run Add this label to force Kokoro to re-run the tests. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spanner: SelectAll does not use the same field matching rules as Row.ToStruct

3 participants