Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringObjectIDCodec ¶
type StringObjectIDCodec struct{}
StringObjectIDCodec is the Codec used for string values. It tries to convert strings into [bson.ObjectID].
func (StringObjectIDCodec) EncodeValue ¶
func (sc StringObjectIDCodec) EncodeValue( _ bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value, ) error
EncodeValue implements the bsoncodec.ValueEncoder interface. The method tries to convert a string value into [bson.ObjectID].
- If a string can be converted into [bson.ObjectID] it returns it as a [bson.ObjectID].
- If a string cannot be converted into [bson.ObjectID] it returns it as a string, without any transformations.
Click to show internal directories.
Click to hide internal directories.