Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWrongOneOfInterface = errors.New("oneof interface not implemented")
Functions ¶
This section is empty.
Types ¶
type CodecBuilder ¶
type CodecBuilder struct {
// contains filtered or unexported fields
}
func CodecBuildersForMessage ¶
func CodecBuildersForMessage( message proto.Message, elementInfo []*ElementInfo, ) ([]*CodecBuilder, error)
func NewCodecBuilder ¶
func NewCodecBuilder() *CodecBuilder
func (*CodecBuilder) AddConcrete ¶
func (builder *CodecBuilder) AddConcrete( oneOfType reflect.Type, bsonType bsontype.Type, binaryType byte, ) error
Register a concrete one of type and the bson type it is encoded to. We don't know what other codecs are in the registry, so to properly round-trip a one-of field we need to create a 1-1 mapping of the wrapper type and it's bson encoded type, except for the special case of message types that encoded to embedded docs, since we can add a field with the proto message type.
func (*CodecBuilder) AutoAddConcrete ¶
func (builder *CodecBuilder) AutoAddConcrete( oneOfTypes ...reflect.Type, ) error
Try to automatically deduce the encoding / decoding mapping of the wrapper types.
func (*CodecBuilder) Register ¶
func (builder *CodecBuilder) Register( registryBuilder *bsoncodec.RegistryBuilder, ) error
type ConcreteTypeCodecInfo ¶
type ConcreteTypeCodecInfo struct { ConcreteType reflect.Type Codec bsoncodec.ValueCodec }
Click to show internal directories.
Click to hide internal directories.