simplify conversion of bson.DateTimes to time.Times in handleAnon

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-03-27 16:04:26 -04:00
parent d328bc3fbd
commit 42954e8502
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -10,7 +10,6 @@ import (
"log"
"reflect"
"strings"
"time"
)
type Query struct {
@ -472,7 +471,7 @@ func handleAnon(raw interface{}, rtype reflect.Type, rval reflect.Value) reflect
if ok {
fval := amap[btag.Name]
if reflect.TypeOf(fval) == reflect.TypeFor[bson.DateTime]() {
fval = time.UnixMilli(int64(fval.(bson.DateTime)))
fval = fval.(bson.DateTime).Time()
}
if valueField.Kind() == reflect.Pointer {
valueField.Elem().Set(reflect.ValueOf(fval))