Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWrapperEmbeddedField = errors.New(
"wrapper messages should not have embedded fields",
)
View Source
var ErrWrapperMessageType = errors.New("wrapper codec expected pointer to struct")
View Source
var ErrWrapperPublicFieldCount = errors.New(
"wrapper expected to have exactly 1 public field",
)
Functions ¶
This section is empty.
Types ¶
type ProtoWrapperCodec ¶
type ProtoWrapperCodec struct {
FieldIndex int
}
Codec for encoding gRPC wrappers.BoolValue, which exposes an API for having nullable boolean values.
func MustWrapperCodec ¶
func MustWrapperCodec(protoMessage proto.Message) ProtoWrapperCodec
func NewWrapperCodec ¶
func NewWrapperCodec(protoMessage interface{}) (ProtoWrapperCodec, error)
Builds the wrapper codec for a given proto message.
Wrapper messages must:
- Have exactly 1 non-embedded public field. This field's value will be extracted and marshalled as the bson value.
func (ProtoWrapperCodec) DecodeValue ¶
func (codec ProtoWrapperCodec) DecodeValue( context bsoncodec.DecodeContext, reader bsonrw.ValueReader, value reflect.Value, ) error
func (ProtoWrapperCodec) EncodeValue ¶
func (codec ProtoWrapperCodec) EncodeValue( context bsoncodec.EncodeContext, writer bsonrw.ValueWriter, value reflect.Value, ) error
Click to show internal directories.
Click to hide internal directories.