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

pgtype: enable deep copy of pgtype.Map #2116

Open
ZhouXing19 opened this issue Aug 27, 2024 · 1 comment
Open

pgtype: enable deep copy of pgtype.Map #2116

ZhouXing19 opened this issue Aug 27, 2024 · 1 comment

Comments

@ZhouXing19
Copy link

I would like to design a "clone" connection function in my program, which takes a parent connection, and run pgx.ConnectConfig() with the same config of the parent connection, and also deep copy the type map of the parent connection.

However, I can't find a way to do such a deep copy, as none of Map.oidToType or nameToType and etc are exported.

So I wonder if we can implement a method like func (m *Map) Clone() Map, or just simply make these not-exported field accessible so that i can loop over entries inside each map.

@jackc
Copy link
Owner

jackc commented Aug 27, 2024

See #2048 for some discussion of copying type maps.

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

No branches or pull requests

2 participants