mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
Upstep Go dependencies (#340)
* Upstep Go dependencies * tiny linter fix * Tidy
This commit is contained in:
23
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
23
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
@ -285,8 +285,8 @@ func (t *Table) processBaseModelField(f reflect.StructField) {
|
||||
|
||||
if isKnownTableOption(tag.Name) {
|
||||
internal.Warn.Printf(
|
||||
"%s.%s tag name %q is also an option name; is it a mistake?",
|
||||
t.TypeName, f.Name, tag.Name,
|
||||
"%s.%s tag name %q is also an option name, is it a mistake? Try table:%s.",
|
||||
t.TypeName, f.Name, tag.Name, tag.Name,
|
||||
)
|
||||
}
|
||||
|
||||
@ -300,6 +300,10 @@ func (t *Table) processBaseModelField(f reflect.StructField) {
|
||||
t.setName(tag.Name)
|
||||
}
|
||||
|
||||
if s, ok := tag.Option("table"); ok {
|
||||
t.setName(s)
|
||||
}
|
||||
|
||||
if s, ok := tag.Option("select"); ok {
|
||||
t.SQLNameForSelects = t.quoteTableName(s)
|
||||
}
|
||||
@ -312,19 +316,23 @@ func (t *Table) processBaseModelField(f reflect.StructField) {
|
||||
|
||||
//nolint
|
||||
func (t *Table) newField(f reflect.StructField, index []int) *Field {
|
||||
sqlName := internal.Underscore(f.Name)
|
||||
tag := tagparser.Parse(f.Tag.Get("bun"))
|
||||
|
||||
sqlName := internal.Underscore(f.Name)
|
||||
if tag.Name != "" && tag.Name != sqlName {
|
||||
if isKnownFieldOption(tag.Name) {
|
||||
internal.Warn.Printf(
|
||||
"%s.%s tag name %q is also an option name; is it a mistake?",
|
||||
t.TypeName, f.Name, tag.Name,
|
||||
"%s.%s tag name %q is also an option name, is it a mistake? Try column:%s.",
|
||||
t.TypeName, f.Name, tag.Name, tag.Name,
|
||||
)
|
||||
}
|
||||
sqlName = tag.Name
|
||||
}
|
||||
|
||||
if s, ok := tag.Option("column"); ok {
|
||||
sqlName = s
|
||||
}
|
||||
|
||||
for name := range tag.Options {
|
||||
if !isKnownFieldOption(name) {
|
||||
internal.Warn.Printf("%s.%s has unknown tag option: %q", t.TypeName, f.Name, name)
|
||||
@ -854,7 +862,7 @@ func appendNew(dst []int, src ...int) []int {
|
||||
|
||||
func isKnownTableOption(name string) bool {
|
||||
switch name {
|
||||
case "alias", "select":
|
||||
case "table", "alias", "select":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -862,7 +870,8 @@ func isKnownTableOption(name string) bool {
|
||||
|
||||
func isKnownFieldOption(name string) bool {
|
||||
switch name {
|
||||
case "alias",
|
||||
case "column",
|
||||
"alias",
|
||||
"type",
|
||||
"array",
|
||||
"hstore",
|
||||
|
Reference in New Issue
Block a user