mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-19 06:44:23 +01:00
Upgrade to pgx v5
This commit is contained in:
17
go.mod
17
go.mod
@@ -16,7 +16,7 @@ require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||
github.com/jackc/pgtype v1.8.1
|
||||
github.com/jackc/pgx/v4 v4.13.0
|
||||
github.com/jackc/pgx/v5 v5.4.3
|
||||
github.com/lightningnetwork/lightning-onion v1.2.1-0.20221202012345-ca23184850a1
|
||||
github.com/lightningnetwork/lnd v0.16.2-beta
|
||||
github.com/lightningnetwork/lnd/tlv v1.1.0
|
||||
@@ -37,6 +37,14 @@ require (
|
||||
github.com/ethereum/go-ethereum v1.12.1 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.10.0 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
github.com/jackc/pgx/v4 v4.13.0 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/lightninglabs/neutrino/cache v1.1.1 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
@@ -104,13 +112,6 @@ require (
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.10.0 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
|
||||
github.com/jackc/puddle v1.1.3 // indirect
|
||||
github.com/jessevdk/go-flags v1.4.0 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
ecies "github.com/ecies/go/v2"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
@@ -193,7 +193,7 @@ func (l *lspBase) Initialize() error {
|
||||
return err
|
||||
}
|
||||
|
||||
pgxPool, err := pgxpool.Connect(l.harness.Ctx, l.postgresBackend.ConnectionString())
|
||||
pgxPool, err := pgxpool.New(l.harness.Ctx, l.postgresBackend.ConnectionString())
|
||||
if err != nil {
|
||||
lntest.PerformCleanup(cleanups)
|
||||
return fmt.Errorf("failed to connect to postgres: %w", err)
|
||||
@@ -301,7 +301,7 @@ type FeeParamSetting struct {
|
||||
}
|
||||
|
||||
func SetFeeParams(l LspNode, settings []*FeeParamSetting) error {
|
||||
pgxPool, err := pgxpool.Connect(l.Harness().Ctx, l.PostgresBackend().ConnectionString())
|
||||
pgxPool, err := pgxpool.New(l.Harness().Ctx, l.PostgresBackend().ConnectionString())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to postgres: %w", err)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/breez/lntest"
|
||||
"github.com/breez/lspd/lightning"
|
||||
"github.com/breez/lspd/lsps0"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ func testLsps2Buy(p *testParams) {
|
||||
err = json.Unmarshal(buyResp.Data, b)
|
||||
lntest.CheckError(p.t, err)
|
||||
|
||||
pgxPool, err := pgxpool.Connect(p.h.Ctx, p.lsp.PostgresBackend().ConnectionString())
|
||||
pgxPool, err := pgxpool.New(p.h.Ctx, p.lsp.PostgresBackend().ConnectionString())
|
||||
if err != nil {
|
||||
p.h.T.Fatalf("Failed to connect to postgres backend: %v", err)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type PostgresContainer struct {
|
||||
@@ -91,7 +91,7 @@ HealthCheck:
|
||||
return fmt.Errorf("container '%s' unhealthy", c.id)
|
||||
case "healthy":
|
||||
for {
|
||||
pgxPool, err := pgxpool.Connect(ctx, c.ConnectionString())
|
||||
pgxPool, err := pgxpool.New(ctx, c.ConnectionString())
|
||||
if err == nil {
|
||||
pgxPool.Close()
|
||||
break HealthCheck
|
||||
@@ -246,7 +246,7 @@ func (c *PostgresContainer) RunMigrations(ctx context.Context, migrationDir stri
|
||||
|
||||
sort.Strings(filenames)
|
||||
|
||||
pgxPool, err := pgxpool.Connect(ctx, c.ConnectionString())
|
||||
pgxPool, err := pgxpool.New(ctx, c.ConnectionString())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to postgres: %w", err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/breez/lntest"
|
||||
lspd "github.com/breez/lspd/rpc"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ func registerPaymentWithTag(p *testParams) {
|
||||
Tag: expected,
|
||||
}, false)
|
||||
|
||||
pgxPool, err := pgxpool.Connect(p.h.Ctx, p.lsp.PostgresBackend().ConnectionString())
|
||||
pgxPool, err := pgxpool.New(p.h.Ctx, p.lsp.PostgresBackend().ConnectionString())
|
||||
if err != nil {
|
||||
p.h.T.Fatalf("Failed to connect to postgres backend: %v", err)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
func PgConnect(databaseUrl string) (*pgxpool.Pool, error) {
|
||||
var err error
|
||||
pgxPool, err := pgxpool.Connect(context.Background(), databaseUrl)
|
||||
pgxPool, err := pgxpool.New(context.Background(), databaseUrl)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("pgxpool.Connect(%v): %w", databaseUrl, err)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/breez/lspd/lnd"
|
||||
"github.com/jackc/pgx/v4"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type ForwardingEventStore struct {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"github.com/breez/lspd/lightning"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/jackc/pgtype"
|
||||
"github.com/jackc/pgx/v4"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type PostgresInterceptStore struct {
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/breez/lspd/lsps0"
|
||||
"github.com/breez/lspd/lsps2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/jackc/pgx/v4"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type Lsps2Store struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/hex"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type NotificationsStore struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/breez/lspd/common"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
type extendedParams struct {
|
||||
|
||||
Reference in New Issue
Block a user