diff options
| author | 2025-01-14 14:23:28 +0000 | |
|---|---|---|
| committer | 2025-01-14 14:23:28 +0000 | |
| commit | b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9 (patch) | |
| tree | 68eaf966c80237e18993e887c8583355f0943ca7 /vendor/github.com/uptrace/bun/model_table_has_many.go | |
| parent | [chore] better dns validation (#3644) (diff) | |
| download | gotosocial-b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9.tar.xz | |
bump uptrace/bun dependencies from 1.2.6 to 1.2.8 (#3645)
Diffstat (limited to 'vendor/github.com/uptrace/bun/model_table_has_many.go')
| -rw-r--r-- | vendor/github.com/uptrace/bun/model_table_has_many.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vendor/github.com/uptrace/bun/model_table_has_many.go b/vendor/github.com/uptrace/bun/model_table_has_many.go index cd721a1b2..f7ace5740 100644 --- a/vendor/github.com/uptrace/bun/model_table_has_many.go +++ b/vendor/github.com/uptrace/bun/model_table_has_many.go @@ -3,6 +3,7 @@ package bun import ( "context" "database/sql" + "database/sql/driver" "fmt" "reflect" @@ -152,7 +153,13 @@ func modelKey(key []interface{}, strct reflect.Value, fields []*schema.Field) [] // The value is then used as a map key. func indirectFieldValue(field reflect.Value) interface{} { if field.Kind() != reflect.Ptr { - return field.Interface() + i := field.Interface() + if valuer, ok := i.(driver.Valuer); ok { + if v, err := valuer.Value(); err == nil { + return v + } + } + return i } if field.IsNil() { return nil |
