Documentation ¶
Index ¶
- Variables
- 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
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBsonRegistryBuilder = NewBsonRegistryBuilder()
Functions ¶
This section is empty.
Types ¶
type BsonCodecsRegistrant ¶
type BsonCodecsRegistrant func(builder *BsonRegistryBuilder)
type BsonRegistryBuilder ¶
type BsonRegistryBuilder struct { *bsoncodec.RegistryBuilder // contains filtered or unexported fields }
BsonRegistryBuilder initializes the mongo driver registry to encode/decode honoring the JSON struct tags. For example, a struct with the following JSON tags:
type Sample struct { FirstName string `json:"first_name"` }
Will serialize the field to BSON as "first_name" instead of "firstname" (default naming strategy).
func NewBsonRegistryBuilder ¶
func NewBsonRegistryBuilder() *BsonRegistryBuilder
func (*BsonRegistryBuilder) Build ¶
func (b *BsonRegistryBuilder) Build()
Build sets this registry as the BSON default
func (*BsonRegistryBuilder) Register ¶
func (b *BsonRegistryBuilder) Register(registrant BsonCodecsRegistrant) *BsonRegistryBuilder
Register a custom codec to the default BSON registry
func (*BsonRegistryBuilder) RegisterAll ¶
func (b *BsonRegistryBuilder) RegisterAll(registrants ...BsonCodecsRegistrant) *BsonRegistryBuilder
RegisterAll register all the custom codecs to the default BSON registry
func (*BsonRegistryBuilder) RegisterTypeDecoder ¶
func (b *BsonRegistryBuilder) RegisterTypeDecoder(t reflect.Type, dec bsoncodec.ValueDecoder)
func (*BsonRegistryBuilder) RegisterTypeEncoder ¶ added in v0.19.1
func (b *BsonRegistryBuilder) RegisterTypeEncoder(t reflect.Type, dec bsoncodec.ValueEncoder)
func (*BsonRegistryBuilder) StructCodec ¶
func (b *BsonRegistryBuilder) StructCodec() *bsoncodec.StructCodec
StructCodec provides the configured bsoncodec.StructCodec in registry
Click to show internal directories.
Click to hide internal directories.