Skip to content

Commit

Permalink
pgx/v4 to pgx/v5
Browse files Browse the repository at this point in the history
  • Loading branch information
andremedeiros committed Mar 24, 2023
1 parent eb7ab04 commit b6cf6b6
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 145 deletions.
20 changes: 8 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ require (
github.com/heroku/x v0.0.55
github.com/honeycombio/honeycomb-opentelemetry-go v0.3.0
github.com/honeycombio/opentelemetry-go-contrib/launcher v0.0.0-20221031150637-a3c60ed98d54
github.com/jackc/pgconn v1.13.0
github.com/jackc/pgx/v4 v4.17.2
github.com/jackc/pgx/v5 v5.3.1
github.com/joho/godotenv v1.4.0
github.com/sideshow/apns2 v0.23.0
github.com/smtp2go-oss/smtp2go-go v1.0.1
Expand Down Expand Up @@ -47,19 +46,16 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.12.0 // indirect
github.com/jackc/puddle v1.3.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/puddle/v2 v2.2.0 // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sethvargo/go-envconfig v0.8.2 // indirect
github.com/shirou/gopsutil/v3 v3.22.9 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -84,11 +80,11 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
Expand Down
135 changes: 18 additions & 117 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/go-redis/redis/v8"
"github.com/gofrs/uuid"
"github.com/gorilla/mux"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2/token"
"go.opentelemetry.io/otel"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/adjust/rmq/v5"
"github.com/go-co-op/gocron"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/spf13/cobra"
"go.uber.org/zap"

Expand Down
9 changes: 5 additions & 4 deletions internal/cmdutil/cmdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/extra/redisotel/v8"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"

"go.uber.org/zap"
)

Expand Down Expand Up @@ -78,11 +80,10 @@ func NewDatabasePool(ctx context.Context, maxConns int) (*pgxpool.Pool, error) {
}

// Setting the build statement cache to nil helps this work with pgbouncer
config.ConnConfig.BuildStatementCache = nil
config.ConnConfig.PreferSimpleProtocol = true
config.ConnConfig.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol
config.MaxConnLifetime = 1 * time.Hour
config.MaxConnIdleTime = 30 * time.Second
return pgxpool.ConnectConfig(ctx, config)
return pgxpool.NewWithConfig(ctx, config)
}

func NewQueueClient(logger *zap.Logger, conn *redis.Client, identifier string) (rmq.Connection, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/repository/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package repository
import (
"context"

"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/testhelper/pgxpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v5"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/worker/live_activities.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/token"
"go.opentelemetry.io/otel/trace"
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/payload"
"github.com/sideshow/apns2/token"
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/stuck_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"

Expand Down
2 changes: 1 addition & 1 deletion internal/worker/subreddits.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/payload"
"github.com/sideshow/apns2/token"
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/trending.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/payload"
"github.com/sideshow/apns2/token"
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/payload"
"github.com/sideshow/apns2/token"
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v5"
"github.com/go-redis/redis/v8"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"
)
Expand Down

0 comments on commit b6cf6b6

Please sign in to comment.