summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgx/v5/pgconn/config.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2025-01-20 10:01:46 +0100
committerLibravatar GitHub <noreply@github.com>2025-01-20 10:01:46 +0100
commitcfe6ac5a42e8d21d3db9a7aff3ac862f401cbf01 (patch)
tree20f9e46b0f1c8e896bded5363f578c1c32523286 /vendor/github.com/jackc/pgx/v5/pgconn/config.go
parent[chore]: Bump github.com/gin-contrib/sessions from 1.0.1 to 1.0.2 (#3664) (diff)
downloadgotosocial-cfe6ac5a42e8d21d3db9a7aff3ac862f401cbf01.tar.xz
[chore]: Bump github.com/jackc/pgx/v5 from 5.7.1 to 5.7.2 (#3663)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.7.1 to 5.7.2. - [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md) - [Commits](https://github.com/jackc/pgx/compare/v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: github.com/jackc/pgx/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/jackc/pgx/v5/pgconn/config.go')
-rw-r--r--vendor/github.com/jackc/pgx/v5/pgconn/config.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/vendor/github.com/jackc/pgx/v5/pgconn/config.go b/vendor/github.com/jackc/pgx/v5/pgconn/config.go
index 6a198e675..46b39f14e 100644
--- a/vendor/github.com/jackc/pgx/v5/pgconn/config.go
+++ b/vendor/github.com/jackc/pgx/v5/pgconn/config.go
@@ -861,12 +861,12 @@ func makeConnectTimeoutDialFunc(timeout time.Duration) DialFunc {
// ValidateConnectTargetSessionAttrsReadWrite is a ValidateConnectFunc that implements libpq compatible
// target_session_attrs=read-write.
func ValidateConnectTargetSessionAttrsReadWrite(ctx context.Context, pgConn *PgConn) error {
- result := pgConn.ExecParams(ctx, "show transaction_read_only", nil, nil, nil, nil).Read()
- if result.Err != nil {
- return result.Err
+ result, err := pgConn.Exec(ctx, "show transaction_read_only").ReadAll()
+ if err != nil {
+ return err
}
- if string(result.Rows[0][0]) == "on" {
+ if string(result[0].Rows[0][0]) == "on" {
return errors.New("read only connection")
}
@@ -876,12 +876,12 @@ func ValidateConnectTargetSessionAttrsReadWrite(ctx context.Context, pgConn *PgC
// ValidateConnectTargetSessionAttrsReadOnly is a ValidateConnectFunc that implements libpq compatible
// target_session_attrs=read-only.
func ValidateConnectTargetSessionAttrsReadOnly(ctx context.Context, pgConn *PgConn) error {
- result := pgConn.ExecParams(ctx, "show transaction_read_only", nil, nil, nil, nil).Read()
- if result.Err != nil {
- return result.Err
+ result, err := pgConn.Exec(ctx, "show transaction_read_only").ReadAll()
+ if err != nil {
+ return err
}
- if string(result.Rows[0][0]) != "on" {
+ if string(result[0].Rows[0][0]) != "on" {
return errors.New("connection is not read only")
}
@@ -891,12 +891,12 @@ func ValidateConnectTargetSessionAttrsReadOnly(ctx context.Context, pgConn *PgCo
// ValidateConnectTargetSessionAttrsStandby is a ValidateConnectFunc that implements libpq compatible
// target_session_attrs=standby.
func ValidateConnectTargetSessionAttrsStandby(ctx context.Context, pgConn *PgConn) error {
- result := pgConn.ExecParams(ctx, "select pg_is_in_recovery()", nil, nil, nil, nil).Read()
- if result.Err != nil {
- return result.Err
+ result, err := pgConn.Exec(ctx, "select pg_is_in_recovery()").ReadAll()
+ if err != nil {
+ return err
}
- if string(result.Rows[0][0]) != "t" {
+ if string(result[0].Rows[0][0]) != "t" {
return errors.New("server is not in hot standby mode")
}
@@ -906,12 +906,12 @@ func ValidateConnectTargetSessionAttrsStandby(ctx context.Context, pgConn *PgCon
// ValidateConnectTargetSessionAttrsPrimary is a ValidateConnectFunc that implements libpq compatible
// target_session_attrs=primary.
func ValidateConnectTargetSessionAttrsPrimary(ctx context.Context, pgConn *PgConn) error {
- result := pgConn.ExecParams(ctx, "select pg_is_in_recovery()", nil, nil, nil, nil).Read()
- if result.Err != nil {
- return result.Err
+ result, err := pgConn.Exec(ctx, "select pg_is_in_recovery()").ReadAll()
+ if err != nil {
+ return err
}
- if string(result.Rows[0][0]) == "t" {
+ if string(result[0].Rows[0][0]) == "t" {
return errors.New("server is in standby mode")
}
@@ -921,12 +921,12 @@ func ValidateConnectTargetSessionAttrsPrimary(ctx context.Context, pgConn *PgCon
// ValidateConnectTargetSessionAttrsPreferStandby is a ValidateConnectFunc that implements libpq compatible
// target_session_attrs=prefer-standby.
func ValidateConnectTargetSessionAttrsPreferStandby(ctx context.Context, pgConn *PgConn) error {
- result := pgConn.ExecParams(ctx, "select pg_is_in_recovery()", nil, nil, nil, nil).Read()
- if result.Err != nil {
- return result.Err
+ result, err := pgConn.Exec(ctx, "select pg_is_in_recovery()").ReadAll()
+ if err != nil {
+ return err
}
- if string(result.Rows[0][0]) != "t" {
+ if string(result[0].Rows[0][0]) != "t" {
return &NotPreferredError{err: errors.New("server is not in hot standby mode")}
}