build(deps): bump the go-deps group across 1 directory with 14 updates
Bumps the go-deps group with 11 updates in the / directory: | Package | From | To | | --- | --- | --- | | [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) | `1.25.1` | `1.26.0` | | [github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://github.com/Azure/azure-sdk-for-go) | `1.5.1` | `1.5.2` | | [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5](https://github.com/Azure/azure-sdk-for-go) | `5.5.0` | `5.7.0` | | [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.51.25` | `1.52.0` | | [github.com/getsentry/sentry-go](https://github.com/getsentry/sentry-go) | `0.26.0` | `0.27.0` | | [github.com/gophercloud/gophercloud](https://github.com/gophercloud/gophercloud) | `1.10.0` | `1.11.0` | | [github.com/jackc/pgtype](https://github.com/jackc/pgtype) | `1.14.1` | `1.14.3` | | [github.com/labstack/echo/v4](https://github.com/labstack/echo) | `4.11.4` | `4.12.0` | | [github.com/openshift-online/ocm-sdk-go](https://github.com/openshift-online/ocm-sdk-go) | `0.1.398` | `0.1.418` | | [github.com/osbuild/images](https://github.com/osbuild/images) | `0.56.0` | `0.58.0` | | [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) | `1.18.0` | `1.19.0` | Updates `cloud.google.com/go/compute` from 1.25.1 to 1.26.0 - [Release notes](https://github.com/googleapis/google-cloud-go/releases) - [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/documentai/CHANGES.md) - [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.25.1...pubsub/v1.26.0) Updates `github.com/Azure/azure-sdk-for-go/sdk/azidentity` from 1.5.1 to 1.5.2 - [Release notes](https://github.com/Azure/azure-sdk-for-go/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md) - [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/internal/v1.5.1...sdk/internal/v1.5.2) Updates `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5` from 5.5.0 to 5.7.0 - [Release notes](https://github.com/Azure/azure-sdk-for-go/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md) - [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/resourcemanager/compute/armcompute/v5.5.0...sdk/resourcemanager/compute/armcompute/v5.7.0) Updates `github.com/aws/aws-sdk-go` from 1.51.25 to 1.52.0 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.25...v1.52.0) Updates `github.com/getsentry/sentry-go` from 0.26.0 to 0.27.0 - [Release notes](https://github.com/getsentry/sentry-go/releases) - [Changelog](https://github.com/getsentry/sentry-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-go/compare/v0.26.0...v0.27.0) Updates `github.com/gophercloud/gophercloud` from 1.10.0 to 1.11.0 - [Release notes](https://github.com/gophercloud/gophercloud/releases) - [Changelog](https://github.com/gophercloud/gophercloud/blob/v1.11.0/CHANGELOG.md) - [Commits](https://github.com/gophercloud/gophercloud/compare/v1.10.0...v1.11.0) Updates `github.com/jackc/pgtype` from 1.14.1 to 1.14.3 - [Changelog](https://github.com/jackc/pgtype/blob/master/CHANGELOG.md) - [Commits](https://github.com/jackc/pgtype/compare/v1.14.1...v1.14.3) Updates `github.com/jackc/pgx/v4` from 4.18.1 to 4.18.2 - [Changelog](https://github.com/jackc/pgx/blob/v4.18.2/CHANGELOG.md) - [Commits](https://github.com/jackc/pgx/compare/v4.18.1...v4.18.2) Updates `github.com/labstack/echo/v4` from 4.11.4 to 4.12.0 - [Release notes](https://github.com/labstack/echo/releases) - [Changelog](https://github.com/labstack/echo/blob/master/CHANGELOG.md) - [Commits](https://github.com/labstack/echo/compare/v4.11.4...v4.12.0) Updates `github.com/openshift-online/ocm-sdk-go` from 0.1.398 to 0.1.418 - [Release notes](https://github.com/openshift-online/ocm-sdk-go/releases) - [Changelog](https://github.com/openshift-online/ocm-sdk-go/blob/main/CHANGES.md) - [Commits](https://github.com/openshift-online/ocm-sdk-go/compare/v0.1.398...v0.1.418) Updates `github.com/osbuild/images` from 0.56.0 to 0.58.0 - [Release notes](https://github.com/osbuild/images/releases) - [Commits](https://github.com/osbuild/images/compare/v0.56.0...v0.58.0) Updates `github.com/prometheus/client_golang` from 1.18.0 to 1.19.0 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.18.0...v1.19.0) Updates `golang.org/x/sync` from 0.6.0 to 0.7.0 - [Commits](https://github.com/golang/sync/compare/v0.6.0...v0.7.0) Updates `google.golang.org/api` from 0.175.0 to 0.177.0 - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.175.0...v0.177.0) --- updated-dependencies: - dependency-name: cloud.google.com/go/compute dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azidentity dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/getsentry/sentry-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/gophercloud/gophercloud dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/jackc/pgtype dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/jackc/pgx/v4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/labstack/echo/v4 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/openshift-online/ocm-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/osbuild/images dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
49566b7ce4
commit
9193f3eebc
285 changed files with 70293 additions and 63914 deletions
16
vendor/github.com/jackc/pgconn/CHANGELOG.md
generated
vendored
16
vendor/github.com/jackc/pgconn/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,19 @@
|
|||
# 1.14.3 (March 4, 2024)
|
||||
|
||||
* Update golang.org/x/crypto and golang.org/x/text
|
||||
|
||||
# 1.14.2 (March 4, 2024)
|
||||
|
||||
* Fix CVE-2024-27304. SQL injection can occur if an attacker can cause a single query or bind message to exceed 4 GB in
|
||||
size. An integer overflow in the calculated message size can cause the one large message to be sent as multiple messages
|
||||
under the attacker's control.
|
||||
|
||||
# 1.14.1 (July 19, 2023)
|
||||
|
||||
* Fix: Enable failover efforts when pg_hba.conf disallows non-ssl connections (Brandon Kauffman)
|
||||
* Fix: connect_timeout is not obeyed for sslmode=allow|prefer (smaher-edb)
|
||||
* Optimize redundant pgpass parsing in case password is explicitly set (Aleksandr Alekseev)
|
||||
|
||||
# 1.14.0 (February 11, 2023)
|
||||
|
||||
* Fix: each connection attempt to new node gets own timeout (Nathan Giardina)
|
||||
|
|
|
|||
12
vendor/github.com/jackc/pgconn/auth_scram.go
generated
vendored
12
vendor/github.com/jackc/pgconn/auth_scram.go
generated
vendored
|
|
@ -41,7 +41,11 @@ func (c *PgConn) scramAuth(serverAuthMechanisms []string) error {
|
|||
AuthMechanism: "SCRAM-SHA-256",
|
||||
Data: sc.clientFirstMessage(),
|
||||
}
|
||||
_, err = c.conn.Write(saslInitialResponse.Encode(nil))
|
||||
buf, err := saslInitialResponse.Encode(nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.conn.Write(buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -60,7 +64,11 @@ func (c *PgConn) scramAuth(serverAuthMechanisms []string) error {
|
|||
saslResponse := &pgproto3.SASLResponse{
|
||||
Data: []byte(sc.clientFinalMessage()),
|
||||
}
|
||||
_, err = c.conn.Write(saslResponse.Encode(nil))
|
||||
buf, err = saslResponse.Encode(nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.conn.Write(buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
6
vendor/github.com/jackc/pgconn/config.go
generated
vendored
6
vendor/github.com/jackc/pgconn/config.go
generated
vendored
|
|
@ -366,9 +366,9 @@ func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*Con
|
|||
config.TLSConfig = fallbacks[0].TLSConfig
|
||||
config.Fallbacks = fallbacks[1:]
|
||||
|
||||
passfile, err := pgpassfile.ReadPassfile(settings["passfile"])
|
||||
if err == nil {
|
||||
if config.Password == "" {
|
||||
if config.Password == "" {
|
||||
passfile, err := pgpassfile.ReadPassfile(settings["passfile"])
|
||||
if err == nil {
|
||||
host := config.Host
|
||||
if network, _ := NetworkAddress(config.Host, config.Port); network == "unix" {
|
||||
host = "localhost"
|
||||
|
|
|
|||
6
vendor/github.com/jackc/pgconn/krb5.go
generated
vendored
6
vendor/github.com/jackc/pgconn/krb5.go
generated
vendored
|
|
@ -62,7 +62,11 @@ func (c *PgConn) gssAuth() error {
|
|||
gssResponse := &pgproto3.GSSResponse{
|
||||
Data: nextData,
|
||||
}
|
||||
_, err = c.conn.Write(gssResponse.Encode(nil))
|
||||
buf, err := gssResponse.Encode(nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.conn.Write(buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
189
vendor/github.com/jackc/pgconn/pgconn.go
generated
vendored
189
vendor/github.com/jackc/pgconn/pgconn.go
generated
vendored
|
|
@ -156,12 +156,15 @@ func ConnectConfig(octx context.Context, config *Config) (pgConn *PgConn, err er
|
|||
|
||||
foundBestServer := false
|
||||
var fallbackConfig *FallbackConfig
|
||||
for _, fc := range fallbackConfigs {
|
||||
for i, fc := range fallbackConfigs {
|
||||
// ConnectTimeout restricts the whole connection process.
|
||||
if config.ConnectTimeout != 0 {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(octx, config.ConnectTimeout)
|
||||
defer cancel()
|
||||
// create new context first time or when previous host was different
|
||||
if i == 0 || (fallbackConfigs[i].Host != fallbackConfigs[i-1].Host) {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(octx, config.ConnectTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
} else {
|
||||
ctx = octx
|
||||
}
|
||||
|
|
@ -176,7 +179,7 @@ func ConnectConfig(octx context.Context, config *Config) (pgConn *PgConn, err er
|
|||
const ERRCODE_INVALID_CATALOG_NAME = "3D000" // db does not exist
|
||||
const ERRCODE_INSUFFICIENT_PRIVILEGE = "42501" // missing connect privilege
|
||||
if pgerr.Code == ERRCODE_INVALID_PASSWORD ||
|
||||
pgerr.Code == ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ||
|
||||
pgerr.Code == ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION && fc.TLSConfig != nil ||
|
||||
pgerr.Code == ERRCODE_INVALID_CATALOG_NAME ||
|
||||
pgerr.Code == ERRCODE_INSUFFICIENT_PRIVILEGE {
|
||||
break
|
||||
|
|
@ -311,7 +314,11 @@ func connect(ctx context.Context, config *Config, fallbackConfig *FallbackConfig
|
|||
startupMsg.Parameters["database"] = config.Database
|
||||
}
|
||||
|
||||
if _, err := pgConn.conn.Write(startupMsg.Encode(pgConn.wbuf)); err != nil {
|
||||
buf, err := startupMsg.Encode(pgConn.wbuf)
|
||||
if err != nil {
|
||||
return nil, &connectError{config: config, msg: "failed to write startup message", err: err}
|
||||
}
|
||||
if _, err := pgConn.conn.Write(buf); err != nil {
|
||||
pgConn.conn.Close()
|
||||
return nil, &connectError{config: config, msg: "failed to write startup message", err: err}
|
||||
}
|
||||
|
|
@ -416,7 +423,11 @@ func startTLS(conn net.Conn, tlsConfig *tls.Config) (net.Conn, error) {
|
|||
|
||||
func (pgConn *PgConn) txPasswordMessage(password string) (err error) {
|
||||
msg := &pgproto3.PasswordMessage{Password: password}
|
||||
_, err = pgConn.conn.Write(msg.Encode(pgConn.wbuf))
|
||||
buf, err := msg.Encode(pgConn.wbuf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = pgConn.conn.Write(buf)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -599,9 +610,10 @@ func (pgConn *PgConn) PID() uint32 {
|
|||
// TxStatus returns the current TxStatus as reported by the server in the ReadyForQuery message.
|
||||
//
|
||||
// Possible return values:
|
||||
// 'I' - idle / not in transaction
|
||||
// 'T' - in a transaction
|
||||
// 'E' - in a failed transaction
|
||||
//
|
||||
// 'I' - idle / not in transaction
|
||||
// 'T' - in a transaction
|
||||
// 'E' - in a failed transaction
|
||||
//
|
||||
// See https://www.postgresql.org/docs/current/protocol-message-formats.html.
|
||||
func (pgConn *PgConn) TxStatus() byte {
|
||||
|
|
@ -828,9 +840,19 @@ func (pgConn *PgConn) Prepare(ctx context.Context, name, sql string, paramOIDs [
|
|||
}
|
||||
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Parse{Name: name, Query: sql, ParameterOIDs: paramOIDs}).Encode(buf)
|
||||
buf = (&pgproto3.Describe{ObjectType: 'S', Name: name}).Encode(buf)
|
||||
buf = (&pgproto3.Sync{}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Parse{Name: name, Query: sql, ParameterOIDs: paramOIDs}).Encode(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf, err = (&pgproto3.Describe{ObjectType: 'S', Name: name}).Encode(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf, err = (&pgproto3.Sync{}).Encode(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
n, err := pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1002,7 +1024,14 @@ func (pgConn *PgConn) Exec(ctx context.Context, sql string) *MultiResultReader {
|
|||
}
|
||||
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
if err != nil {
|
||||
return &MultiResultReader{
|
||||
closed: true,
|
||||
err: err,
|
||||
}
|
||||
}
|
||||
|
||||
n, err := pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1076,8 +1105,24 @@ func (pgConn *PgConn) ExecParams(ctx context.Context, sql string, paramValues []
|
|||
}
|
||||
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Parse{Query: sql, ParameterOIDs: paramOIDs}).Encode(buf)
|
||||
buf = (&pgproto3.Bind{ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Parse{Query: sql, ParameterOIDs: paramOIDs}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return result
|
||||
}
|
||||
|
||||
buf, err = (&pgproto3.Bind{ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return result
|
||||
}
|
||||
|
||||
pgConn.execExtendedSuffix(buf, result)
|
||||
|
||||
|
|
@ -1103,7 +1148,15 @@ func (pgConn *PgConn) ExecPrepared(ctx context.Context, stmtName string, paramVa
|
|||
}
|
||||
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Bind{PreparedStatement: stmtName, ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Bind{PreparedStatement: stmtName, ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return result
|
||||
}
|
||||
|
||||
pgConn.execExtendedSuffix(buf, result)
|
||||
|
||||
|
|
@ -1146,9 +1199,31 @@ func (pgConn *PgConn) execExtendedPrefix(ctx context.Context, paramValues [][]by
|
|||
}
|
||||
|
||||
func (pgConn *PgConn) execExtendedSuffix(buf []byte, result *ResultReader) {
|
||||
buf = (&pgproto3.Describe{ObjectType: 'P'}).Encode(buf)
|
||||
buf = (&pgproto3.Execute{}).Encode(buf)
|
||||
buf = (&pgproto3.Sync{}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Describe{ObjectType: 'P'}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return
|
||||
}
|
||||
buf, err = (&pgproto3.Execute{}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return
|
||||
}
|
||||
buf, err = (&pgproto3.Sync{}).Encode(buf)
|
||||
if err != nil {
|
||||
result.concludeCommand(nil, err)
|
||||
pgConn.contextWatcher.Unwatch()
|
||||
result.closed = true
|
||||
pgConn.unlock()
|
||||
return
|
||||
}
|
||||
|
||||
n, err := pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1182,7 +1257,12 @@ func (pgConn *PgConn) CopyTo(ctx context.Context, w io.Writer, sql string) (Comm
|
|||
|
||||
// Send copy to command
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
if err != nil {
|
||||
pgConn.unlock()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
n, err := pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1242,7 +1322,12 @@ func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (Co
|
|||
|
||||
// Send copy to command
|
||||
buf := pgConn.wbuf
|
||||
buf = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
var err error
|
||||
buf, err = (&pgproto3.Query{String: sql}).Encode(buf)
|
||||
if err != nil {
|
||||
pgConn.unlock()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
n, err := pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1318,10 +1403,20 @@ func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (Co
|
|||
buf = buf[:0]
|
||||
if copyErr == io.EOF || pgErr != nil {
|
||||
copyDone := &pgproto3.CopyDone{}
|
||||
buf = copyDone.Encode(buf)
|
||||
var err error
|
||||
buf, err = copyDone.Encode(buf)
|
||||
if err != nil {
|
||||
pgConn.asyncClose()
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
copyFail := &pgproto3.CopyFail{Message: copyErr.Error()}
|
||||
buf = copyFail.Encode(buf)
|
||||
var err error
|
||||
buf, err = copyFail.Encode(buf)
|
||||
if err != nil {
|
||||
pgConn.asyncClose()
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
_, err = pgConn.conn.Write(buf)
|
||||
if err != nil {
|
||||
|
|
@ -1628,24 +1723,54 @@ func (rr *ResultReader) concludeCommand(commandTag CommandTag, err error) {
|
|||
// Batch is a collection of queries that can be sent to the PostgreSQL server in a single round-trip.
|
||||
type Batch struct {
|
||||
buf []byte
|
||||
err error
|
||||
}
|
||||
|
||||
// ExecParams appends an ExecParams command to the batch. See PgConn.ExecParams for parameter descriptions.
|
||||
func (batch *Batch) ExecParams(sql string, paramValues [][]byte, paramOIDs []uint32, paramFormats []int16, resultFormats []int16) {
|
||||
batch.buf = (&pgproto3.Parse{Query: sql, ParameterOIDs: paramOIDs}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
batch.buf, batch.err = (&pgproto3.Parse{Query: sql, ParameterOIDs: paramOIDs}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
batch.ExecPrepared("", paramValues, paramFormats, resultFormats)
|
||||
}
|
||||
|
||||
// ExecPrepared appends an ExecPrepared e command to the batch. See PgConn.ExecPrepared for parameter descriptions.
|
||||
func (batch *Batch) ExecPrepared(stmtName string, paramValues [][]byte, paramFormats []int16, resultFormats []int16) {
|
||||
batch.buf = (&pgproto3.Bind{PreparedStatement: stmtName, ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(batch.buf)
|
||||
batch.buf = (&pgproto3.Describe{ObjectType: 'P'}).Encode(batch.buf)
|
||||
batch.buf = (&pgproto3.Execute{}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
batch.buf, batch.err = (&pgproto3.Bind{PreparedStatement: stmtName, ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
batch.buf, batch.err = (&pgproto3.Describe{ObjectType: 'P'}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
batch.buf, batch.err = (&pgproto3.Execute{}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// ExecBatch executes all the queries in batch in a single round-trip. Execution is implicitly transactional unless a
|
||||
// transaction is already in progress or SQL contains transaction control statements.
|
||||
func (pgConn *PgConn) ExecBatch(ctx context.Context, batch *Batch) *MultiResultReader {
|
||||
if batch.err != nil {
|
||||
return &MultiResultReader{
|
||||
closed: true,
|
||||
err: batch.err,
|
||||
}
|
||||
}
|
||||
|
||||
if err := pgConn.lock(); err != nil {
|
||||
return &MultiResultReader{
|
||||
closed: true,
|
||||
|
|
@ -1671,7 +1796,13 @@ func (pgConn *PgConn) ExecBatch(ctx context.Context, batch *Batch) *MultiResultR
|
|||
pgConn.contextWatcher.Watch(ctx)
|
||||
}
|
||||
|
||||
batch.buf = (&pgproto3.Sync{}).Encode(batch.buf)
|
||||
batch.buf, batch.err = (&pgproto3.Sync{}).Encode(batch.buf)
|
||||
if batch.err != nil {
|
||||
multiResult.closed = true
|
||||
multiResult.err = batch.err
|
||||
pgConn.unlock()
|
||||
return multiResult
|
||||
}
|
||||
|
||||
// A large batch can deadlock without concurrent reading and writing. If the Write fails the underlying net.Conn is
|
||||
// closed. This is all that can be done without introducing a race condition or adding a concurrent safe communication
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue