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