Adde gitea workflow: tests
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 57s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 57s
This commit is contained in:
@@ -69,7 +69,7 @@ func (t *RFC3339Time) UnmarshalText(data []byte) error {
|
||||
}
|
||||
|
||||
func (t *RFC3339Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
||||
if bt == bsontype.Null {
|
||||
if bt == bson.TypeNull {
|
||||
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
||||
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
||||
// https://stackoverflow.com/questions/75167597
|
||||
@@ -77,7 +77,7 @@ func (t *RFC3339Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
||||
*t = RFC3339Time{}
|
||||
return nil
|
||||
}
|
||||
if bt != bsontype.DateTime {
|
||||
if bt != bson.TypeDateTime {
|
||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339Time", bt))
|
||||
}
|
||||
var tt time.Time
|
||||
|
@@ -69,7 +69,7 @@ func (t *RFC3339NanoTime) UnmarshalText(data []byte) error {
|
||||
}
|
||||
|
||||
func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
||||
if bt == bsontype.Null {
|
||||
if bt == bson.TypeNull {
|
||||
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
||||
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
||||
// https://stackoverflow.com/questions/75167597
|
||||
@@ -77,7 +77,7 @@ func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) erro
|
||||
*t = RFC3339NanoTime{}
|
||||
return nil
|
||||
}
|
||||
if bt != bsontype.DateTime {
|
||||
if bt != bson.TypeDateTime {
|
||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339NanoTime", bt))
|
||||
}
|
||||
var tt time.Time
|
||||
|
@@ -2,6 +2,7 @@ package rfctime
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/timeext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/tst"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -13,7 +14,7 @@ func TestRoundtrip(t *testing.T) {
|
||||
Value RFC3339NanoTime `json:"v"`
|
||||
}
|
||||
|
||||
val1 := NewRFC3339Nano(time.Unix(0, 1675951556820915171))
|
||||
val1 := NewRFC3339Nano(time.Unix(0, 1675951556820915171).In(timeext.TimezoneBerlin))
|
||||
w1 := Wrap{val1}
|
||||
|
||||
jstr1, err := json.Marshal(w1)
|
||||
|
Reference in New Issue
Block a user