Repository navigation
fix: implement pgx.Rows TypeMap for pgx v5.11 - #63
Merged
Merged
Conversation
pgx v5.11.0 added TypeMap() to the pgx.Rows interface, so Rows, RowsRecorder and RowsError no longer satisfied it and the package failed to compile. - Rows returns the registry it already scans cached rows with. - RowsRecorder delegates to the wrapped rows. - RowsError returns nil, which pgx documents as valid for a Rows that carries only an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
maindoesn't compile againstgithub.com/jackc/pgx/v5v5.11.0 (required since #59), because v5.11.0 addedTypeMap() *pgtype.Mapto thepgx.Rowsinterface:This also blocks downstream consumers from taking pgx 5.11 (e.g. hellohippo/pharmacy-api#469).
Changes
Rows.TypeMap()returns theregistryit already uses to scan cached rows.RowsRecorder.TypeMap()delegates to the wrappedpgx.Rows.RowsError.TypeMap()returnsnil, which pgx documents as valid for a Rows "representing only an error".MockRowsin tests gets a matchingTypeMapFn, plus one spec per new method.Verification
go build ./...andgo vet ./...cleanginkgo ./...against Postgres 17 (PGX_DATABASE_URLset): 67/67 specs passed, 0 skipped