mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] bump bun (and related libraries) versions to v1.1.16 (#2209)
This commit is contained in:
39
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
39
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
@ -4,7 +4,6 @@ import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -807,38 +806,18 @@ func (t *Table) m2mRelation(field *Field) *Relation {
|
||||
return rel
|
||||
}
|
||||
|
||||
type seenKey struct {
|
||||
Table reflect.Type
|
||||
FieldIndex string
|
||||
}
|
||||
|
||||
type seenMap map[seenKey]struct{}
|
||||
|
||||
func NewSeenKey(table reflect.Type, fieldIndex []int) (key seenKey) {
|
||||
key.Table = table
|
||||
for _, index := range fieldIndex {
|
||||
key.FieldIndex += strconv.Itoa(index) + "-"
|
||||
}
|
||||
return key
|
||||
}
|
||||
|
||||
func (s seenMap) Clone() seenMap {
|
||||
t := make(seenMap)
|
||||
for k, v := range s {
|
||||
t[k] = v
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *Table) inlineFields(field *Field, seen seenMap) {
|
||||
func (t *Table) inlineFields(field *Field, seen map[reflect.Type]struct{}) {
|
||||
if seen == nil {
|
||||
seen = make(seenMap)
|
||||
seen = map[reflect.Type]struct{}{t.Type: {}}
|
||||
}
|
||||
|
||||
if _, ok := seen[field.IndirectType]; ok {
|
||||
return
|
||||
}
|
||||
seen[field.IndirectType] = struct{}{}
|
||||
|
||||
joinTable := t.dialect.Tables().Ref(field.IndirectType)
|
||||
for _, f := range joinTable.allFields {
|
||||
key := NewSeenKey(joinTable.Type, f.Index)
|
||||
|
||||
f = f.Clone()
|
||||
f.GoName = field.GoName + "_" + f.GoName
|
||||
f.Name = field.Name + "__" + f.Name
|
||||
@ -855,9 +834,7 @@ func (t *Table) inlineFields(field *Field, seen seenMap) {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, ok := seen[key]; !ok {
|
||||
seen = seen.Clone()
|
||||
seen[key] = struct{}{}
|
||||
if _, ok := seen[f.IndirectType]; !ok {
|
||||
t.inlineFields(f, seen)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user