updated mongo driver dependencies to v2
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m27s

This commit is contained in:
2026-04-21 12:11:38 +02:00
parent 84b87d61f2
commit 0c37dd5576
36 changed files with 187 additions and 582 deletions
+5 -39
View File
@@ -1,51 +1,17 @@
package mongoext
import (
"git.blackforestbytes.com/BlackForestBytes/goext/exerr"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"git.blackforestbytes.com/BlackForestBytes/goext/rfctime"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/bsoncodec"
"go.mongodb.org/mongo-driver/bson/primitive"
"reflect"
"go.mongodb.org/mongo-driver/v2/bson"
)
func CreateGoExtBsonRegistry() *bsoncodec.Registry {
func CreateGoExtBsonRegistry() *bson.Registry {
reg := bson.NewRegistry()
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.RFC3339Time](), rfctime.RFC3339Time{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.RFC3339Time](), rfctime.RFC3339Time{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.RFC3339NanoTime](), rfctime.RFC3339NanoTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.RFC3339NanoTime](), rfctime.RFC3339NanoTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.UnixTime](), rfctime.UnixTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.UnixTime](), rfctime.UnixTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.UnixMilliTime](), rfctime.UnixMilliTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.UnixMilliTime](), rfctime.UnixMilliTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.UnixNanoTime](), rfctime.UnixNanoTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.UnixNanoTime](), rfctime.UnixNanoTime{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.Date](), rfctime.Date{})
reg.RegisterTypeDecoder(reflect.TypeFor[*rfctime.Date](), rfctime.Date{})
reg.RegisterTypeDecoder(reflect.TypeFor[rfctime.SecondsF64](), rfctime.SecondsF64(0))
reg.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(rfctime.SecondsF64(0))), rfctime.SecondsF64(0))
reg.RegisterTypeDecoder(reflect.TypeFor[exerr.ErrorCategory](), exerr.ErrorCategory{})
reg.RegisterTypeDecoder(reflect.TypeOf(new(exerr.ErrorCategory{})), exerr.ErrorCategory{})
reg.RegisterTypeDecoder(reflect.TypeFor[exerr.ErrorSeverity](), exerr.ErrorSeverity{})
reg.RegisterTypeDecoder(reflect.TypeOf(new(exerr.ErrorSeverity{})), exerr.ErrorSeverity{})
reg.RegisterTypeDecoder(reflect.TypeFor[exerr.ErrorType](), exerr.ErrorType{})
reg.RegisterTypeDecoder(reflect.TypeOf(new(exerr.ErrorType{})), exerr.ErrorType{})
// otherwise we get []primitve.E when unmarshalling into any
// otherwise we get []bson.E when unmarshalling into any
// which will result in {'key': .., 'value': ...}[] json when json-marshalling
reg.RegisterTypeMapEntry(bson.TypeEmbeddedDocument, reflect.TypeFor[primitive.M]())
reg.RegisterTypeMapEntry(bson.TypeEmbeddedDocument, reflect.TypeFor[bson.M]())
return reg
}