diff --git a/mongo.go b/mongo.go index 7e381c5..94579c2 100644 --- a/mongo.go +++ b/mongo.go @@ -7,11 +7,14 @@ import ( "go.mongodb.org/mongo-driver/bson/bsonrw" ) -func Encoder(encodeContext bsoncodec.EncodeContext, writer bsonrw.ValueWriter, value reflect.Value) error { +type BsonDecoderEncoder struct { +} + +func (BsonDecoderEncoder) EncodeValue(encodeContext bsoncodec.EncodeContext, writer bsonrw.ValueWriter, value reflect.Value) error { return writer.WriteString(value.Interface().(Decimal).String()) } -func Decoder(decodeContext bsoncodec.DecodeContext, reader bsonrw.ValueReader, value reflect.Value) error { +func (BsonDecoderEncoder) DecodeValue(decodeContext bsoncodec.DecodeContext, reader bsonrw.ValueReader, value reflect.Value) error { str, err := reader.ReadString() if err != nil { return err