simplify conversion of bson.DateTime
s to time.Time
s in handleAnon
This commit is contained in:
parent
d328bc3fbd
commit
42954e8502
3
query.go
3
query.go
@ -10,7 +10,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Query struct {
|
type Query struct {
|
||||||
@ -472,7 +471,7 @@ func handleAnon(raw interface{}, rtype reflect.Type, rval reflect.Value) reflect
|
|||||||
if ok {
|
if ok {
|
||||||
fval := amap[btag.Name]
|
fval := amap[btag.Name]
|
||||||
if reflect.TypeOf(fval) == reflect.TypeFor[bson.DateTime]() {
|
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 {
|
if valueField.Kind() == reflect.Pointer {
|
||||||
valueField.Elem().Set(reflect.ValueOf(fval))
|
valueField.Elem().Set(reflect.ValueOf(fval))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user