Compare commits

...

1 Commits

Author SHA1 Message Date
c13db6802e v0.0.102 2023-04-13 14:40:07 +02:00
2 changed files with 8 additions and 0 deletions

View File

@@ -66,6 +66,10 @@ func (t *RFC3339Time) UnmarshalText(data []byte) error {
} }
func (t *RFC3339Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error { func (t *RFC3339Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
if bt == bsontype.Null {
*t = RFC3339Time{}
return nil
}
if bt != bsontype.DateTime { if bt != bsontype.DateTime {
return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339Time", bt)) return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339Time", bt))
} }

View File

@@ -66,6 +66,10 @@ func (t *RFC3339NanoTime) UnmarshalText(data []byte) error {
} }
func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error { func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
if bt == bsontype.Null {
*t = RFC3339NanoTime{}
return nil
}
if bt != bsontype.DateTime { if bt != bsontype.DateTime {
return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339NanoTime", bt)) return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339NanoTime", bt))
} }