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 option to handle nil Valuers #1993

Closed
wants to merge 1 commit into from

Conversation

sajanalexander
Copy link

This is a fix for #1566 to add an option to handle cases where we've passed a value that is considered nil by anynil, but may have a value which can be substituted, like in the case where something implements the Valuer interface and returns a default value.

Note that I needed to add an option to pgx.Conn to be able to modify the conn.TypeMap(). I couldn't figure out another way to do this when using the stdlib.

Please let me know if this is on the right track and/or needs any modifications.

@jackc
Copy link
Owner

jackc commented May 18, 2024

pgx supports for driver.Valuer in its native interface. Fixing this issue only for stdlib / database/sql would mean that driver.Valuer would behave differently depending on whether the type was used with pgx directly or through database/sql.

So I don't think this approach will work. However, it was still valuable. It got me thinking about this problem again and I think I found a simpler solution than was discussed in #1566. See PR #2019 .

@jackc jackc closed this May 18, 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