v0.0.111
This commit is contained in:
@@ -3,29 +3,20 @@ package mongoext
|
||||
import (
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
||||
"go.mongodb.org/mongo-driver/bson/bsonrw"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/rfctime"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func CreateGoExtBsonRegistry() *bsoncodec.Registry {
|
||||
var primitiveCodecs bson.PrimitiveCodecs
|
||||
|
||||
rb := bsoncodec.NewRegistryBuilder()
|
||||
|
||||
rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339Time{}), rfctime.RFC3339Time{})
|
||||
rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339Time{}), rfctime.RFC3339NanoTime{})
|
||||
|
||||
bsoncodec.DefaultValueEncoders{}.RegisterDefaultEncoders(rb)
|
||||
bsoncodec.DefaultValueDecoders{}.RegisterDefaultDecoders(rb)
|
||||
|
||||
rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339Time{}), rfctime.RFC3339Time{})
|
||||
|
||||
primitiveCodecs.RegisterPrimitiveCodecs(rb)
|
||||
bson.PrimitiveCodecs{}.RegisterPrimitiveCodecs(rb)
|
||||
|
||||
return rb.Build()
|
||||
}
|
||||
|
||||
func encodeRFC3339Time(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) {
|
||||
|
||||
}
|
||||
|
||||
func decodeRFC3339Time(ec bsoncodec.EncodeContext, vr bsonrw.ValueReader, val reflect.Value) {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user