mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
This reverts commit bba7c23957.
This commit is contained in:
5
vendor/github.com/jmoiron/sqlx/.travis.yml
generated
vendored
5
vendor/github.com/jmoiron/sqlx/.travis.yml
generated
vendored
@@ -18,8 +18,9 @@ before_install:
|
||||
|
||||
# go versions to test
|
||||
go:
|
||||
- "1.15.x"
|
||||
- "1.16.x"
|
||||
- "1.10.x"
|
||||
- "1.11.x"
|
||||
- "1.12.x"
|
||||
|
||||
# run tests w/ coverage
|
||||
script:
|
||||
|
||||
2
vendor/github.com/jmoiron/sqlx/bind.go
generated
vendored
2
vendor/github.com/jmoiron/sqlx/bind.go
generated
vendored
@@ -24,7 +24,7 @@ const (
|
||||
var defaultBinds = map[int][]string{
|
||||
DOLLAR: []string{"postgres", "pgx", "pq-timeouts", "cloudsqlpostgres", "ql", "nrpostgres", "cockroach"},
|
||||
QUESTION: []string{"mysql", "sqlite3", "nrmysql", "nrsqlite3"},
|
||||
NAMED: []string{"oci8", "ora", "goracle", "godror"},
|
||||
NAMED: []string{"oci8", "ora", "goracle"},
|
||||
AT: []string{"sqlserver"},
|
||||
}
|
||||
|
||||
|
||||
38
vendor/github.com/jmoiron/sqlx/named.go
generated
vendored
38
vendor/github.com/jmoiron/sqlx/named.go
generated
vendored
@@ -224,47 +224,21 @@ func bindStruct(bindType int, query string, arg interface{}, m *reflectx.Mapper)
|
||||
return bound, arglist, nil
|
||||
}
|
||||
|
||||
var valuesReg = regexp.MustCompile(`\)\s*(?i)VALUES\s*\(`)
|
||||
|
||||
func findMatchingClosingBracketIndex(s string) int {
|
||||
count := 0
|
||||
for i, ch := range s {
|
||||
if ch == '(' {
|
||||
count++
|
||||
}
|
||||
if ch == ')' {
|
||||
count--
|
||||
if count == 0 {
|
||||
return i
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
var valueBracketReg = regexp.MustCompile(`\([^(]*.[^(]\)$`)
|
||||
|
||||
func fixBound(bound string, loop int) string {
|
||||
loc := valuesReg.FindStringIndex(bound)
|
||||
// defensive guard when "VALUES (...)" not found
|
||||
if len(loc) < 2 {
|
||||
loc := valueBracketReg.FindStringIndex(bound)
|
||||
if len(loc) != 2 {
|
||||
return bound
|
||||
}
|
||||
|
||||
openingBracketIndex := loc[1] - 1
|
||||
index := findMatchingClosingBracketIndex(bound[openingBracketIndex:])
|
||||
// defensive guard. must have closing bracket
|
||||
if index == 0 {
|
||||
return bound
|
||||
}
|
||||
closingBracketIndex := openingBracketIndex + index + 1
|
||||
|
||||
var buffer bytes.Buffer
|
||||
|
||||
buffer.WriteString(bound[0:closingBracketIndex])
|
||||
buffer.WriteString(bound[0:loc[1]])
|
||||
for i := 0; i < loop-1; i++ {
|
||||
buffer.WriteString(",")
|
||||
buffer.WriteString(bound[openingBracketIndex:closingBracketIndex])
|
||||
buffer.WriteString(bound[loc[0]:loc[1]])
|
||||
}
|
||||
buffer.WriteString(bound[closingBracketIndex:])
|
||||
buffer.WriteString(bound[loc[1]:])
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
|
||||
8
vendor/github.com/jmoiron/sqlx/sqlx.go
generated
vendored
8
vendor/github.com/jmoiron/sqlx/sqlx.go
generated
vendored
@@ -878,10 +878,9 @@ func structOnlyError(t reflect.Type) error {
|
||||
}
|
||||
|
||||
// scanAll scans all rows into a destination, which must be a slice of any
|
||||
// type. It resets the slice length to zero before appending each element to
|
||||
// the slice. If the destination slice type is a Struct, then StructScan will
|
||||
// be used on each row. If the destination is some other kind of base type,
|
||||
// then each row must only have one column which can scan into that type. This
|
||||
// type. If the destination slice type is a Struct, then StructScan will be
|
||||
// used on each row. If the destination is some other kind of base type, then
|
||||
// each row must only have one column which can scan into that type. This
|
||||
// allows you to do something like:
|
||||
//
|
||||
// rows, _ := db.Query("select id from people;")
|
||||
@@ -911,7 +910,6 @@ func scanAll(rows rowsi, dest interface{}, structOnly bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
direct.SetLen(0)
|
||||
|
||||
isPtr := slice.Elem().Kind() == reflect.Ptr
|
||||
base := reflectx.Deref(slice.Elem())
|
||||
|
||||
Reference in New Issue
Block a user