Documentation
¶
Index ¶
- Variables
- func BuildDefaultRegistry()
- func BuildRegistry() *bsoncodec.Registry
- func Dump(t *testing.T, title string, bytes []byte)
- func IsAlreadyRegistered(registrar Registrar) bool
- func MarshalWithRegistry(registry *bsoncodec.Registry, value interface{}) ([]byte, error)
- func Register(registrar Registrar)
- func UnmarshalWithRegistry(registry *bsoncodec.Registry, bs []byte, value interface{}) error
- type BsonCodecsRegistrant
- type BsonRegistryBuilder
- func (b *BsonRegistryBuilder) Build()
- func (b *BsonRegistryBuilder) Register(registrant BsonCodecsRegistrant) *BsonRegistryBuilder
- func (b *BsonRegistryBuilder) RegisterAll(registrants ...BsonCodecsRegistrant) *BsonRegistryBuilder
- func (b *BsonRegistryBuilder) RegisterTypeDecoder(t reflect.Type, dec bsoncodec.ValueDecoder)
- func (b *BsonRegistryBuilder) RegisterTypeEncoder(t reflect.Type, dec bsoncodec.ValueEncoder)
- func (b *BsonRegistryBuilder) StructCodec() *bsoncodec.StructCodec
- type EncoderDecoder
- type GetType
- type Registrant
- type Registrar
- type TypedGenericCodex
- func (t *TypedGenericCodex[Typed]) DecodeValue(ctx bsoncodec.DecodeContext, reader bsonrw.ValueReader, value reflect.Value) error
- func (t *TypedGenericCodex[Typed]) EncodeValue(ctx bsoncodec.EncodeContext, writer bsonrw.ValueWriter, value reflect.Value) error
- func (t *TypedGenericCodex[Typed]) Register(builder Registrant)
- func (t *TypedGenericCodex[Typed]) RegisterType(factory func() Typed, toDto func(Typed) interface{}, ...)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBsonRegistryBuilder = NewBsonRegistryBuilder()
Functions ¶
func BuildDefaultRegistry ¶ added in v0.34.0
func BuildDefaultRegistry()
BuildDefaultRegistry builds the default registry to be used by the mongo driver Previous registries are discarded
func BuildRegistry ¶ added in v0.34.0
BuildRegistry creates a new registry configured with the default encoders and decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types, the PrimitiveCodecs type in this package, and all registered registrars.
func IsAlreadyRegistered ¶ added in v0.34.0
IsAlreadyRegistered checks if a Registrar is already registered.
func MarshalWithRegistry ¶ added in v0.44.1
func Register ¶ added in v0.34.0
func Register(registrar Registrar)
Register registers a Registrar to the list of registrars. If the Registrar is already registered, it will not be registered again. This function is not thread-safe, and it is typically called from init() functions.