Documentation
¶
Index ¶
- func NewCerealRegistryBuilder(opts *Opts) (*bsoncodec.RegistryBuilder, error)
- func RegisterCerealCodecs(builder *bsoncodec.RegistryBuilder, opts *Opts) error
- type Opts
- func (opts *Opts) WithAddDefaultCodecs(add bool) *Opts
- func (opts *Opts) WithCustomWrappers(wrapperMessages ...proto.Message) *Opts
- func (opts *Opts) WithEnumStrings(enable bool) *Opts
- func (opts *Opts) WithOneOfElementMapping(innerValue interface{}, bsonType bsontype.Type, binarySubType byte) *Opts
- func (opts *Opts) WithOneOfFields(messages ...proto.Message) *Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCerealRegistryBuilder ¶
func NewCerealRegistryBuilder(opts *Opts) (*bsoncodec.RegistryBuilder, error)
func RegisterCerealCodecs ¶
func RegisterCerealCodecs(builder *bsoncodec.RegistryBuilder, opts *Opts) error
Register a the cereal codecs onto a registry builder.
Types ¶
type Opts ¶
type Opts struct {
// contains filtered or unexported fields
}
Holds options for registering codecs.
func (*Opts) WithAddDefaultCodecs ¶
Whether to add the default mongo codecs to the registry. Default: true.
func (*Opts) WithCustomWrappers ¶
Add a new wrapper type (as wrapperspb.StringValue) that is not one of protoCereal's default wrapper codecs.
func (*Opts) WithEnumStrings ¶
Whether to add the default mongo codecs to the registry. Default: true.
func (*Opts) WithOneOfElementMapping ¶
func (opts *Opts) WithOneOfElementMapping( innerValue interface{}, bsonType bsontype.Type, binarySubType byte, ) *Opts
Add a proto oneof element type and it's bson mapping for generating. This is only needed if a oneof element's type cannot be automatically inferred (you have registered a custom encoder for it.)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.