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

feat(contrib/drivers/pgsql): add array type varchar[] and text[] converting to Go []string support #4000

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

ninjashixuan
Copy link
Contributor

No description provided.

@gqcn
Copy link
Member

gqcn commented Dec 4, 2024

@ninjashixuan Please add associated unit testing case for your commit in package contrib/drivers/pgsql.

@gqcn gqcn changed the title feat(contrib/drivers/pgsql): scan and gf gen dao support pg array (varchar[] and text[]) to Go []string feat(contrib/drivers/pgsql): add array type varchar[] and text[] support converting to Go []string Dec 4, 2024
@gqcn gqcn changed the title feat(contrib/drivers/pgsql): add array type varchar[] and text[] support converting to Go []string feat(contrib/drivers/pgsql): add array type varchar[] and text[] converting support to Go []string Dec 4, 2024
@gqcn gqcn changed the title feat(contrib/drivers/pgsql): add array type varchar[] and text[] converting support to Go []string feat(contrib/drivers/pgsql): add array type varchar[] and text[] converting to Go []string support Dec 4, 2024
@ninjashixuan
Copy link
Contributor Author

@gqcn Oops, I forgot to add the test cases earlier. they're in now.

@gqcn gqcn merged commit 4ad061f into gogf:master Dec 5, 2024
20 checks passed
@ninjashixuan ninjashixuan deleted the pg-scan-convert branch December 10, 2024 01:59
@ninjashixuan
Copy link
Contributor Author

https://github.com/ninjashixuan/gf/blob/baad29c1cc1774762a4a0e8ecc94a18f7175efb3/contrib/drivers/pgsql/pgsql_convert.go#L124-L130
This shouldn't return the pg.StringArray. Instead, return []string(result). This way, gconv.Strings skips an extra layer of reflection and assignment, reducing some performance overhead. I won’t submit a separate PR for this minor change.
@gqcn

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