Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
gqcn merged 2 commits intogogf:masterfrom
ninjashixuan:pg-scan-convert
Dec 5, 2024
Merged

feat(contrib/drivers/pgsql): add array type varchar[] and text[] converting to Go []string support#4000
gqcn merged 2 commits intogogf:masterfrom
ninjashixuan:pg-scan-convert

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
@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