updated dependencies
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-04-28 17:51:43 +02:00
parent 2ed127c238
commit 6b569681fe
6 changed files with 125 additions and 60 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.20
require ( require (
github.com/labstack/echo/v4 v4.10.2 github.com/labstack/echo/v4 v4.10.2
github.com/lib/pq v1.10.7 github.com/lib/pq v1.10.9
golang.org/x/net v0.9.0 golang.org/x/net v0.9.0
gopkg.in/ini.v1 v1.67.0 gopkg.in/ini.v1 v1.67.0
xorm.io/xorm v1.3.2 xorm.io/xorm v1.3.2

2
go.sum
View File

@ -226,6 +226,8 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=

82
vendor/github.com/lib/pq/conn.go generated vendored
View File

@ -2,6 +2,7 @@ package pq
import ( import (
"bufio" "bufio"
"bytes"
"context" "context"
"crypto/md5" "crypto/md5"
"crypto/sha256" "crypto/sha256"
@ -112,7 +113,9 @@ type defaultDialer struct {
func (d defaultDialer) Dial(network, address string) (net.Conn, error) { func (d defaultDialer) Dial(network, address string) (net.Conn, error) {
return d.d.Dial(network, address) return d.d.Dial(network, address)
} }
func (d defaultDialer) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error) { func (d defaultDialer) DialTimeout(
network, address string, timeout time.Duration,
) (net.Conn, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel() defer cancel()
return d.DialContext(ctx, network, address) return d.DialContext(ctx, network, address)
@ -260,13 +263,16 @@ func (cn *conn) handlePgpass(o values) {
} }
defer file.Close() defer file.Close()
scanner := bufio.NewScanner(io.Reader(file)) scanner := bufio.NewScanner(io.Reader(file))
hostname := o["host"]
ntw, _ := network(o)
port := o["port"]
db := o["dbname"]
username := o["user"]
// From: https://github.com/tg/pgpass/blob/master/reader.go // From: https://github.com/tg/pgpass/blob/master/reader.go
getFields := func(s string) []string { for scanner.Scan() {
if scanText(scanner.Text(), o) {
break
}
}
}
// GetFields is a helper function for scanText.
func getFields(s string) []string {
fs := make([]string, 0, 5) fs := make([]string, 0, 5)
f := make([]rune, 0, len(s)) f := make([]rune, 0, len(s))
@ -286,21 +292,27 @@ func (cn *conn) handlePgpass(o values) {
} }
} }
return append(fs, string(f)) return append(fs, string(f))
} }
for scanner.Scan() {
line := scanner.Text() // ScanText assists HandlePgpass in it's objective.
func scanText(line string, o values) bool {
hostname := o["host"]
ntw, _ := network(o)
port := o["port"]
db := o["dbname"]
username := o["user"]
if len(line) == 0 || line[0] == '#' { if len(line) == 0 || line[0] == '#' {
continue return false
} }
split := getFields(line) split := getFields(line)
if len(split) != 5 { if len(split) != 5 {
continue return false
} }
if (split[0] == "*" || split[0] == hostname || (split[0] == "localhost" && (hostname == "" || ntw == "unix"))) && (split[1] == "*" || split[1] == port) && (split[2] == "*" || split[2] == db) && (split[3] == "*" || split[3] == username) { if (split[0] == "*" || split[0] == hostname || (split[0] == "localhost" && (hostname == "" || ntw == "unix"))) && (split[1] == "*" || split[1] == port) && (split[2] == "*" || split[2] == db) && (split[3] == "*" || split[3] == username) {
o["password"] = split[4] o["password"] = split[4]
return return true
}
} }
return false
} }
func (cn *conn) writeBuf(b byte) *writeBuf { func (cn *conn) writeBuf(b byte) *writeBuf {
@ -765,7 +777,9 @@ func (noRows) RowsAffected() (int64, error) {
// Decides which column formats to use for a prepared statement. The input is // Decides which column formats to use for a prepared statement. The input is
// an array of type oids, one element per result column. // an array of type oids, one element per result column.
func decideColumnFormats(colTyps []fieldDesc, forceText bool) (colFmts []format, colFmtData []byte) { func decideColumnFormats(
colTyps []fieldDesc, forceText bool,
) (colFmts []format, colFmtData []byte) {
if len(colTyps) == 0 { if len(colTyps) == 0 {
return nil, colFmtDataAllText return nil, colFmtDataAllText
} }
@ -1647,6 +1661,18 @@ func QuoteIdentifier(name string) string {
return `"` + strings.Replace(name, `"`, `""`, -1) + `"` return `"` + strings.Replace(name, `"`, `""`, -1) + `"`
} }
// BufferQuoteIdentifier satisfies the same purpose as QuoteIdentifier, but backed by a
// byte buffer.
func BufferQuoteIdentifier(name string, buffer *bytes.Buffer) {
end := strings.IndexRune(name, 0)
if end > -1 {
name = name[:end]
}
buffer.WriteRune('"')
buffer.WriteString(strings.Replace(name, `"`, `""`, -1))
buffer.WriteRune('"')
}
// QuoteLiteral quotes a 'literal' (e.g. a parameter, often used to pass literal // QuoteLiteral quotes a 'literal' (e.g. a parameter, often used to pass literal
// to DDL and other statements that do not accept parameters) to be used as part // to DDL and other statements that do not accept parameters) to be used as part
// of an SQL statement. For example: // of an SQL statement. For example:
@ -1808,7 +1834,11 @@ func (cn *conn) readParseResponse() {
} }
} }
func (cn *conn) readStatementDescribeResponse() (paramTyps []oid.Oid, colNames []string, colTyps []fieldDesc) { func (cn *conn) readStatementDescribeResponse() (
paramTyps []oid.Oid,
colNames []string,
colTyps []fieldDesc,
) {
for { for {
t, r := cn.recv1() t, r := cn.recv1()
switch t { switch t {
@ -1896,7 +1926,9 @@ func (cn *conn) postExecuteWorkaround() {
} }
// Only for Exec(), since we ignore the returned data // Only for Exec(), since we ignore the returned data
func (cn *conn) readExecuteResponse(protocolState string) (res driver.Result, commandTag string, err error) { func (cn *conn) readExecuteResponse(
protocolState string,
) (res driver.Result, commandTag string, err error) {
for { for {
t, r := cn.recv1() t, r := cn.recv1()
switch t { switch t {
@ -2062,3 +2094,19 @@ func alnumLowerASCII(ch rune) rune {
} }
return -1 // discard return -1 // discard
} }
// The database/sql/driver package says:
// All Conn implementations should implement the following interfaces: Pinger, SessionResetter, and Validator.
var _ driver.Pinger = &conn{}
var _ driver.SessionResetter = &conn{}
func (cn *conn) ResetSession(ctx context.Context) error {
// Ensure bad connections are reported: From database/sql/driver:
// If a connection is never returned to the connection pool but immediately reused, then
// ResetSession is called prior to reuse but IsValid is not called.
return cn.err.get()
}
func (cn *conn) IsValid() bool {
return cn.err.get() == nil
}

8
vendor/github.com/lib/pq/conn_go115.go generated vendored Normal file
View File

@ -0,0 +1,8 @@
//go:build go1.15
// +build go1.15
package pq
import "database/sql/driver"
var _ driver.Validator = &conn{}

35
vendor/github.com/lib/pq/copy.go generated vendored
View File

@ -1,6 +1,7 @@
package pq package pq
import ( import (
"bytes"
"context" "context"
"database/sql/driver" "database/sql/driver"
"encoding/binary" "encoding/binary"
@ -20,29 +21,35 @@ var (
// CopyIn creates a COPY FROM statement which can be prepared with // CopyIn creates a COPY FROM statement which can be prepared with
// Tx.Prepare(). The target table should be visible in search_path. // Tx.Prepare(). The target table should be visible in search_path.
func CopyIn(table string, columns ...string) string { func CopyIn(table string, columns ...string) string {
stmt := "COPY " + QuoteIdentifier(table) + " (" buffer := bytes.NewBufferString("COPY ")
BufferQuoteIdentifier(table, buffer)
buffer.WriteString(" (")
makeStmt(buffer, columns...)
return buffer.String()
}
// MakeStmt makes the stmt string for CopyIn and CopyInSchema.
func makeStmt(buffer *bytes.Buffer, columns ...string) {
//s := bytes.NewBufferString()
for i, col := range columns { for i, col := range columns {
if i != 0 { if i != 0 {
stmt += ", " buffer.WriteString(", ")
} }
stmt += QuoteIdentifier(col) BufferQuoteIdentifier(col, buffer)
} }
stmt += ") FROM STDIN" buffer.WriteString(") FROM STDIN")
return stmt
} }
// CopyInSchema creates a COPY FROM statement which can be prepared with // CopyInSchema creates a COPY FROM statement which can be prepared with
// Tx.Prepare(). // Tx.Prepare().
func CopyInSchema(schema, table string, columns ...string) string { func CopyInSchema(schema, table string, columns ...string) string {
stmt := "COPY " + QuoteIdentifier(schema) + "." + QuoteIdentifier(table) + " (" buffer := bytes.NewBufferString("COPY ")
for i, col := range columns { BufferQuoteIdentifier(schema, buffer)
if i != 0 { buffer.WriteRune('.')
stmt += ", " BufferQuoteIdentifier(table, buffer)
} buffer.WriteString(" (")
stmt += QuoteIdentifier(col) makeStmt(buffer, columns...)
} return buffer.String()
stmt += ") FROM STDIN"
return stmt
} }
type copyin struct { type copyin struct {

2
vendor/modules.txt vendored
View File

@ -24,7 +24,7 @@ github.com/labstack/echo/v4
## explicit; go 1.12 ## explicit; go 1.12
github.com/labstack/gommon/color github.com/labstack/gommon/color
github.com/labstack/gommon/log github.com/labstack/gommon/log
# github.com/lib/pq v1.10.7 # github.com/lib/pq v1.10.9
## explicit; go 1.13 ## explicit; go 1.13
github.com/lib/pq github.com/lib/pq
github.com/lib/pq/oid github.com/lib/pq/oid