summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/scan.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-14 14:23:28 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-14 14:23:28 +0000
commitb8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9 (patch)
tree68eaf966c80237e18993e887c8583355f0943ca7 /vendor/github.com/uptrace/bun/schema/scan.go
parent[chore] better dns validation (#3644) (diff)
downloadgotosocial-b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9.tar.xz
bump uptrace/bun dependencies from 1.2.6 to 1.2.8 (#3645)
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/scan.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/scan.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/scan.go b/vendor/github.com/uptrace/bun/schema/scan.go
index 4da160daf..9db46cd6f 100644
--- a/vendor/github.com/uptrace/bun/schema/scan.go
+++ b/vendor/github.com/uptrace/bun/schema/scan.go
@@ -18,7 +18,7 @@ import (
"github.com/uptrace/bun/internal"
)
-var scannerType = reflect.TypeOf((*sql.Scanner)(nil)).Elem()
+var scannerType = reflect.TypeFor[sql.Scanner]()
type ScannerFunc func(dest reflect.Value, src interface{}) error
@@ -38,8 +38,8 @@ func init() {
reflect.Uint32: scanUint64,
reflect.Uint64: scanUint64,
reflect.Uintptr: scanUint64,
- reflect.Float32: scanFloat64,
- reflect.Float64: scanFloat64,
+ reflect.Float32: scanFloat,
+ reflect.Float64: scanFloat,
reflect.Complex64: nil,
reflect.Complex128: nil,
reflect.Array: nil,
@@ -214,11 +214,14 @@ func scanUint64(dest reflect.Value, src interface{}) error {
}
}
-func scanFloat64(dest reflect.Value, src interface{}) error {
+func scanFloat(dest reflect.Value, src interface{}) error {
switch src := src.(type) {
case nil:
dest.SetFloat(0)
return nil
+ case float32:
+ dest.SetFloat(float64(src))
+ return nil
case float64:
dest.SetFloat(src)
return nil