mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
Update dependencies (#333)
This commit is contained in:
12
vendor/github.com/jackc/pgx/v4/CHANGELOG.md
generated
vendored
12
vendor/github.com/jackc/pgx/v4/CHANGELOG.md
generated
vendored
@@ -1,3 +1,15 @@
|
||||
# 4.14.0 (November 20, 2021)
|
||||
|
||||
* Upgrade pgconn to v1.10.1
|
||||
* Upgrade pgproto3 to v2.2.0
|
||||
* Upgrade pgtype to v1.9.0
|
||||
* Upgrade puddle to v1.2.0
|
||||
* Add QueryFunc to BatchResults
|
||||
* Add context options to zerologadapter (Thomas Frössman)
|
||||
* Add zerologadapter.NewContextLogger (urso)
|
||||
* Eager initialize minpoolsize on connect (Daniel)
|
||||
* Unpin memory used by large queries immediately after use
|
||||
|
||||
# 4.13.0 (July 24, 2021)
|
||||
|
||||
* Trimmed pseudo-dependencies in Go modules from other packages tests
|
||||
|
4
vendor/github.com/jackc/pgx/v4/README.md
generated
vendored
4
vendor/github.com/jackc/pgx/v4/README.md
generated
vendored
@@ -73,7 +73,7 @@ pgx supports many features beyond what is available through `database/sql`:
|
||||
* Single-round trip query mode
|
||||
* Full TLS connection control
|
||||
* Binary format support for custom types (allows for much quicker encoding/decoding)
|
||||
* Copy protocol support for faster bulk data loads
|
||||
* COPY protocol support for faster bulk data loads
|
||||
* Extendable logging support including built-in support for `log15adapter`, [`logrus`](https://github.com/sirupsen/logrus), [`zap`](https://github.com/uber-go/zap), and [`zerolog`](https://github.com/rs/zerolog)
|
||||
* Connection pool with after-connect hook for arbitrary connection setup
|
||||
* Listen / notify
|
||||
@@ -149,7 +149,7 @@ In addition, there are tests specific for PgBouncer that will be executed if `PG
|
||||
|
||||
## Supported Go and PostgreSQL Versions
|
||||
|
||||
pgx supports the same versions of Go and PostgreSQL that are supported by their respective teams. For [Go](https://golang.org/doc/devel/release.html#policy) that is the two most recent major releases and for [PostgreSQL](https://www.postgresql.org/support/versioning/) the major releases in the last 5 years. This means pgx supports Go 1.15 and higher and PostgreSQL 9.6 and higher. pgx also is tested against the latest version of [CockroachDB](https://www.cockroachlabs.com/product/).
|
||||
pgx supports the same versions of Go and PostgreSQL that are supported by their respective teams. For [Go](https://golang.org/doc/devel/release.html#policy) that is the two most recent major releases and for [PostgreSQL](https://www.postgresql.org/support/versioning/) the major releases in the last 5 years. This means pgx supports Go 1.16 and higher and PostgreSQL 10 and higher. pgx also is tested against the latest version of [CockroachDB](https://www.cockroachlabs.com/product/).
|
||||
|
||||
## Version Policy
|
||||
|
||||
|
30
vendor/github.com/jackc/pgx/v4/batch.go
generated
vendored
30
vendor/github.com/jackc/pgx/v4/batch.go
generated
vendored
@@ -41,6 +41,9 @@ type BatchResults interface {
|
||||
// QueryRow reads the results from the next query in the batch as if the query has been sent with Conn.QueryRow.
|
||||
QueryRow() Row
|
||||
|
||||
// QueryFunc reads the results from the next query in the batch as if the query has been sent with Conn.QueryFunc.
|
||||
QueryFunc(scans []interface{}, f func(QueryFuncRow) error) (pgconn.CommandTag, error)
|
||||
|
||||
// Close closes the batch operation. This must be called before the underlying connection can be used again. Any error
|
||||
// that occurred during a batch operation may have made it impossible to resyncronize the connection with the server.
|
||||
// In this case the underlying connection will have been closed.
|
||||
@@ -135,6 +138,33 @@ func (br *batchResults) Query() (Rows, error) {
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
// QueryFunc reads the results from the next query in the batch as if the query has been sent with Conn.QueryFunc.
|
||||
func (br *batchResults) QueryFunc(scans []interface{}, f func(QueryFuncRow) error) (pgconn.CommandTag, error) {
|
||||
rows, err := br.Query()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
err = rows.Scan(scans...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = f(rows)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rows.CommandTag(), nil
|
||||
}
|
||||
|
||||
// QueryRow reads the results from the next query in the batch as if the query has been sent with QueryRow.
|
||||
func (br *batchResults) QueryRow() Row {
|
||||
rows, _ := br.Query()
|
||||
|
22
vendor/github.com/jackc/pgx/v4/conn.go
generated
vendored
22
vendor/github.com/jackc/pgx/v4/conn.go
generated
vendored
@@ -50,6 +50,7 @@ func (cc *ConnConfig) Copy() *ConnConfig {
|
||||
return newConfig
|
||||
}
|
||||
|
||||
// ConnString returns the connection string as parsed by pgx.ParseConfig into pgx.ConnConfig.
|
||||
func (cc *ConnConfig) ConnString() string { return cc.connString }
|
||||
|
||||
// BuildStatementCacheFunc is a function that can be used to create a stmtcache.Cache implementation for connection.
|
||||
@@ -107,8 +108,8 @@ func Connect(ctx context.Context, connString string) (*Conn, error) {
|
||||
return connect(ctx, connConfig)
|
||||
}
|
||||
|
||||
// Connect establishes a connection with a PostgreSQL server with a configuration struct. connConfig must have been
|
||||
// created by ParseConfig.
|
||||
// ConnectConfig establishes a connection with a PostgreSQL server with a configuration struct.
|
||||
// connConfig must have been created by ParseConfig.
|
||||
func ConnectConfig(ctx context.Context, connConfig *ConnConfig) (*Conn, error) {
|
||||
return connect(ctx, connConfig)
|
||||
}
|
||||
@@ -324,6 +325,7 @@ func (c *Conn) WaitForNotification(ctx context.Context) (*pgconn.Notification, e
|
||||
return n, err
|
||||
}
|
||||
|
||||
// IsClosed reports if the connection has been closed.
|
||||
func (c *Conn) IsClosed() bool {
|
||||
return c.pgConn.IsClosed()
|
||||
}
|
||||
@@ -357,6 +359,8 @@ func quoteIdentifier(s string) string {
|
||||
return `"` + strings.ReplaceAll(s, `"`, `""`) + `"`
|
||||
}
|
||||
|
||||
// Ping executes an empty sql statement against the *Conn
|
||||
// If the sql returns without error, the database Ping is considered successful, otherwise, the error is returned.
|
||||
func (c *Conn) Ping(ctx context.Context) error {
|
||||
_, err := c.Exec(ctx, ";")
|
||||
return err
|
||||
@@ -517,6 +521,7 @@ func (c *Conn) execParams(ctx context.Context, sd *pgconn.StatementDescription,
|
||||
}
|
||||
|
||||
result := c.pgConn.ExecParams(ctx, sd.SQL, c.eqb.paramValues, sd.ParamOIDs, c.eqb.paramFormats, c.eqb.resultFormats).Read()
|
||||
c.eqb.Reset() // Allow c.eqb internal memory to be GC'ed as soon as possible.
|
||||
return result.CommandTag, result.Err
|
||||
}
|
||||
|
||||
@@ -527,6 +532,7 @@ func (c *Conn) execPrepared(ctx context.Context, sd *pgconn.StatementDescription
|
||||
}
|
||||
|
||||
result := c.pgConn.ExecPrepared(ctx, sd.Name, c.eqb.paramValues, c.eqb.paramFormats, c.eqb.resultFormats).Read()
|
||||
c.eqb.Reset() // Allow c.eqb internal memory to be GC'ed as soon as possible.
|
||||
return result.CommandTag, result.Err
|
||||
}
|
||||
|
||||
@@ -558,8 +564,12 @@ type QueryResultFormats []int16
|
||||
// QueryResultFormatsByOID controls the result format (text=0, binary=1) of a query by the result column OID.
|
||||
type QueryResultFormatsByOID map[uint32]int16
|
||||
|
||||
// Query executes sql with args. If there is an error the returned Rows will be returned in an error state. So it is
|
||||
// allowed to ignore the error returned from Query and handle it in Rows.
|
||||
// Query executes sql with args. It is safe to attempt to read from the returned Rows even if an error is returned. The
|
||||
// error will be the available in rows.Err() after rows are closed. So it is allowed to ignore the error returned from
|
||||
// Query and handle it in Rows.
|
||||
//
|
||||
// Err() on the returned Rows must be checked after the Rows is closed to determine if the query executed successfully
|
||||
// as some errors can only be detected by reading the entire response. e.g. A divide by zero error on the last row.
|
||||
//
|
||||
// For extra control over how the query is executed, the types QuerySimpleProtocol, QueryResultFormats, and
|
||||
// QueryResultFormatsByOID may be used as the first args to control exactly how the query is executed. This is rarely
|
||||
@@ -670,6 +680,8 @@ optionLoop:
|
||||
rows.resultReader = c.pgConn.ExecPrepared(ctx, sd.Name, c.eqb.paramValues, c.eqb.paramFormats, resultFormats)
|
||||
}
|
||||
|
||||
c.eqb.Reset() // Allow c.eqb internal memory to be GC'ed as soon as possible.
|
||||
|
||||
return rows, rows.err
|
||||
}
|
||||
|
||||
@@ -817,6 +829,8 @@ func (c *Conn) SendBatch(ctx context.Context, b *Batch) BatchResults {
|
||||
}
|
||||
}
|
||||
|
||||
c.eqb.Reset() // Allow c.eqb internal memory to be GC'ed as soon as possible.
|
||||
|
||||
mrr := c.pgConn.ExecBatch(ctx, batch)
|
||||
|
||||
return &batchResults{
|
||||
|
2
vendor/github.com/jackc/pgx/v4/doc.go
generated
vendored
2
vendor/github.com/jackc/pgx/v4/doc.go
generated
vendored
@@ -309,7 +309,7 @@ CopyFrom can be faster than an insert with as few as 5 rows.
|
||||
Listen and Notify
|
||||
|
||||
pgx can listen to the PostgreSQL notification system with the `Conn.WaitForNotification` method. It blocks until a
|
||||
context is received or the context is canceled.
|
||||
notification is received or the context is canceled.
|
||||
|
||||
_, err := conn.Exec(context.Background(), "listen channelname")
|
||||
if err != nil {
|
||||
|
33
vendor/github.com/jackc/pgx/v4/extended_query_builder.go
generated
vendored
33
vendor/github.com/jackc/pgx/v4/extended_query_builder.go
generated
vendored
@@ -13,8 +13,6 @@ type extendedQueryBuilder struct {
|
||||
paramValueBytes []byte
|
||||
paramFormats []int16
|
||||
resultFormats []int16
|
||||
|
||||
resetCount int
|
||||
}
|
||||
|
||||
func (eqb *extendedQueryBuilder) AppendParam(ci *pgtype.ConnInfo, oid uint32, arg interface{}) error {
|
||||
@@ -34,32 +32,27 @@ func (eqb *extendedQueryBuilder) AppendResultFormat(f int16) {
|
||||
eqb.resultFormats = append(eqb.resultFormats, f)
|
||||
}
|
||||
|
||||
// Reset readies eqb to build another query.
|
||||
func (eqb *extendedQueryBuilder) Reset() {
|
||||
eqb.paramValues = eqb.paramValues[0:0]
|
||||
eqb.paramValueBytes = eqb.paramValueBytes[0:0]
|
||||
eqb.paramFormats = eqb.paramFormats[0:0]
|
||||
eqb.resultFormats = eqb.resultFormats[0:0]
|
||||
|
||||
eqb.resetCount++
|
||||
|
||||
// Every so often shrink our reserved memory if it is abnormally high
|
||||
if eqb.resetCount%128 == 0 {
|
||||
if cap(eqb.paramValues) > 64 {
|
||||
eqb.paramValues = make([][]byte, 0, cap(eqb.paramValues)/2)
|
||||
}
|
||||
|
||||
if cap(eqb.paramValueBytes) > 256 {
|
||||
eqb.paramValueBytes = make([]byte, 0, cap(eqb.paramValueBytes)/2)
|
||||
}
|
||||
|
||||
if cap(eqb.paramFormats) > 64 {
|
||||
eqb.paramFormats = make([]int16, 0, cap(eqb.paramFormats)/2)
|
||||
}
|
||||
if cap(eqb.resultFormats) > 64 {
|
||||
eqb.resultFormats = make([]int16, 0, cap(eqb.resultFormats)/2)
|
||||
}
|
||||
if cap(eqb.paramValues) > 64 {
|
||||
eqb.paramValues = make([][]byte, 0, 64)
|
||||
}
|
||||
|
||||
if cap(eqb.paramValueBytes) > 256 {
|
||||
eqb.paramValueBytes = make([]byte, 0, 256)
|
||||
}
|
||||
|
||||
if cap(eqb.paramFormats) > 64 {
|
||||
eqb.paramFormats = make([]int16, 0, 64)
|
||||
}
|
||||
if cap(eqb.resultFormats) > 64 {
|
||||
eqb.resultFormats = make([]int16, 0, 64)
|
||||
}
|
||||
}
|
||||
|
||||
func (eqb *extendedQueryBuilder) encodeExtendedParamValue(ci *pgtype.ConnInfo, oid uint32, formatCode int16, arg interface{}) ([]byte, error) {
|
||||
|
8
vendor/github.com/jackc/pgx/v4/tx.go
generated
vendored
8
vendor/github.com/jackc/pgx/v4/tx.go
generated
vendored
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/jackc/pgconn"
|
||||
)
|
||||
|
||||
// TxIsoLevel is the transaction isolation level (serializable, repeatable read, read committed or read uncommitted)
|
||||
type TxIsoLevel string
|
||||
|
||||
// Transaction isolation levels
|
||||
@@ -20,6 +21,7 @@ const (
|
||||
ReadUncommitted = TxIsoLevel("read uncommitted")
|
||||
)
|
||||
|
||||
// TxAccessMode is the transaction access mode (read write or read only)
|
||||
type TxAccessMode string
|
||||
|
||||
// Transaction access modes
|
||||
@@ -28,6 +30,7 @@ const (
|
||||
ReadOnly = TxAccessMode("read only")
|
||||
)
|
||||
|
||||
// TxDeferrableMode is the transaction deferrable mode (deferrable or not deferrable)
|
||||
type TxDeferrableMode string
|
||||
|
||||
// Transaction deferrable modes
|
||||
@@ -36,6 +39,7 @@ const (
|
||||
NotDeferrable = TxDeferrableMode("not deferrable")
|
||||
)
|
||||
|
||||
// TxOptions are transaction modes within a transaction block
|
||||
type TxOptions struct {
|
||||
IsoLevel TxIsoLevel
|
||||
AccessMode TxAccessMode
|
||||
@@ -109,7 +113,7 @@ func (c *Conn) BeginTxFunc(ctx context.Context, txOptions TxOptions, f func(Tx)
|
||||
}
|
||||
defer func() {
|
||||
rollbackErr := tx.Rollback(ctx)
|
||||
if !(rollbackErr == nil || errors.Is(rollbackErr, ErrTxClosed)) {
|
||||
if rollbackErr != nil && !errors.Is(rollbackErr, ErrTxClosed) {
|
||||
err = rollbackErr
|
||||
}
|
||||
}()
|
||||
@@ -203,7 +207,7 @@ func (tx *dbTx) BeginFunc(ctx context.Context, f func(Tx) error) (err error) {
|
||||
}
|
||||
defer func() {
|
||||
rollbackErr := savepoint.Rollback(ctx)
|
||||
if !(rollbackErr == nil || errors.Is(rollbackErr, ErrTxClosed)) {
|
||||
if rollbackErr != nil && !errors.Is(rollbackErr, ErrTxClosed) {
|
||||
err = rollbackErr
|
||||
}
|
||||
}()
|
||||
|
Reference in New Issue
Block a user