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

Set a ValueTranscoder from the same type errors #161

Open
jschaf opened this issue May 23, 2022 · 1 comment
Open

Set a ValueTranscoder from the same type errors #161

jschaf opened this issue May 23, 2022 · 1 comment

Comments

@jschaf
Copy link
Contributor

jschaf commented May 23, 2022

I'm trying to generate code to handle a composite type that contains a pgtype.Interval: jschaf/pggen#49. The main issue seems to be that pgtype doesn't support Set with the same type. This test case shows the error:

func TestPgtype_Interval(t *testing.T) {
	v1 := pgtype.Interval{Days: 2, Status: pgtype.Present}
	v2 := pgtype.Interval{Days: 2, Status: pgtype.Present}
	err := v1.Set(v2)
	require.NoError(t, err) // Received unexpected error: cannot convert {0 2 0 2} to Interval
}

Two questions:

  1. Is it reasonable to support Set from the same type? Get returns the same type so it'd have a nice symmetry.
  2. Would you take a PR for this feature?
@jackc
Copy link
Owner

jackc commented May 23, 2022

Seems reasonable.

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