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 snake case support to RowToStructByName #1846

Merged
merged 3 commits into from Dec 25, 2023
Merged

Add snake case support to RowToStructByName #1846

merged 3 commits into from Dec 25, 2023

Conversation

ghost
Copy link

@ghost ghost commented Dec 22, 2023

RowToStructureByName doesn't support the conversion of snake_case to PascalCase, which is used in Go.

@jackc
Copy link
Owner

jackc commented Dec 23, 2023

  • It looks like this broken existing tests / behavior.
  • It would be good to have tests for this new behavior?
  • Is the kebab-case support necessary? That is only possible in PostgreSQL if using double-quotes around the identifiers. I've never actually seen it in the wild.

@ghost
Copy link
Author

ghost commented Dec 23, 2023

  • It looks like this broken existing tests / behavior.
  • It would be good to have tests for this new behavior?

Yeah, I didn't think that small changes would break anything. It's looks like this is happening because of the struct tags, I'll fix it

  • Is the kebab-case support necessary? That is only possible in PostgreSQL if using double-quotes around the identifiers. I've never actually seen it in the wild.

No, I don't think so. I've never seen it too 😃

@jackc
Copy link
Owner

jackc commented Dec 25, 2023

I'll merge this as is.

I am slightly concerned about performance as this adds two string allocations for every assignment. But I think there is already some reflection in that path so it might not matter.

@jackc jackc merged commit 4367ee0 into jackc:master Dec 25, 2023
14 checks passed
@ghost ghost deleted the snake_case_support branch December 25, 2023 16:57
@ghost ghost changed the title Add snake_case support to RowToStructByName Add snake case support to RowToStructByName Jan 27, 2024
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.

2 participants