-
Notifications
You must be signed in to change notification settings - Fork 253
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
db: switch driver to pgx5 #3258
Merged
Merged
Conversation
This file contains 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
KatieMSB
approved these changes
Sep 5, 2023
Forfold
reviewed
Sep 5, 2023
Forfold
approved these changes
Sep 5, 2023
1ddo
pushed a commit
to 1ddo/goalert
that referenced
this pull request
Sep 7, 2023
* update swo sqlc output to pgx v5 * update swosync to v5 * update swoinfo to use v5 * update swomsg to use pgxpool (v5) * update harness to use v5 * update app to use v5 * formatting * swo to v5 * ensure connections are closed * run tidy * leave formatting to separate PR
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.
Description:
Updates the rest of the application to use pgx v5 from v4.
Out of Scope:
Migrating from
github.com/jackc/pgtype
->github.com/jackc/pgx/v5/pgtype
will be done in a separate PR.Technical Details:
During the migration, we encountered the question of whether to use
pgxpool.Pool
or continue usingsql.DB
in a few places. Here are some insights into why certain choices were made:pgxpool.Pool
is a native PGX type, whilesql.DB
is from the Go standard library.swomsg
package was previously usingsql.DB
and converting it into apgx
connection and back again, adding unnecessary boilerplate. This has been streamlined by directly usingpgxpool.Pool
.pgxpool
was used directly where possible elsewhere in theswo
code to eliminate boilerplate code.AcquireConn
method, which allowed fetching a PGX-native connection object from asql.DB
, has been removed inpgx v5
, further justifying the use ofpgxpool.Pool
where possible.The GoAlert application code continues to use Go's standard library interfaces (
sql.DB
), while theswo
components have been upgraded to use the native PGX interfaces (pgxpool.Pool
).