Documentation ¶
Index ¶
- Variables
- func ClipTimestamp(timestamp *timestamppb.Timestamp)
- type Decimal
- func (*Decimal) Descriptor() ([]byte, []int)deprecated
- func (x *Decimal) GetHigh() uint64
- func (x *Decimal) GetLow() uint64
- func (*Decimal) ProtoMessage()
- func (x *Decimal) ProtoReflect() protoreflect.Message
- func (x *Decimal) Reset()
- func (x *Decimal) String() string
- func (x *Decimal) ToBson() primitive.Decimal128
- type RawData
- type UUID
- func (*UUID) Descriptor() ([]byte, []int)deprecated
- func (x *UUID) GetBin() []byte
- func (x *UUID) MustGoogle() googleUUID.UUID
- func (x *UUID) MustMongo() mongoUUID.UUID
- func (*UUID) ProtoMessage()
- func (x *UUID) ProtoReflect() protoreflect.Message
- func (x *UUID) Reset()
- func (x *UUID) Scan(src interface{}) error
- func (x *UUID) String() string
- func (x *UUID) ToGoogle() (googleUUID.UUID, error)
- func (x *UUID) ToMongo() (mongoUUID.UUID, error)
- func (x *UUID) Validate() error
- func (x *UUID) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var ErrUUIDByteLen = errors.New("proto uuid message must be 16 bytes")
var File_cereal_proto_decimal_proto protoreflect.FileDescriptor
var File_cereal_proto_raw_data_proto protoreflect.FileDescriptor
var File_cereal_proto_uuid_proto protoreflect.FileDescriptor
Functions ¶
func ClipTimestamp ¶
func ClipTimestamp(timestamp *timestamppb.Timestamp)
Mongo db only stores time down to the millisecond, this method clips the accuracy of the protobuf time message to match mongo db. This can be useful for testing code round trips through BSON / the database.
Types ¶
type Decimal ¶
type Decimal struct { // High bytes High uint64 `protobuf:"varint,1,opt,name=high,proto3" json:"high,omitempty"` // low bytes Low uint64 `protobuf:"varint,2,opt,name=low,proto3" json:"low,omitempty"` // contains filtered or unexported fields }
Decimal 128 binary that matches the bson specification using a dual uint64 encoding.
func DecimalFromBson ¶
func DecimalFromBson(value primitive.Decimal128) *Decimal
func (*Decimal) Descriptor
deprecated
func (*Decimal) ProtoMessage ¶
func (*Decimal) ProtoMessage()
func (*Decimal) ProtoReflect ¶
func (x *Decimal) ProtoReflect() protoreflect.Message
func (*Decimal) ToBson ¶
func (x *Decimal) ToBson() primitive.Decimal128
type RawData ¶
type RawData struct { // Raw data bytes go here. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
Wrapper type for Raw binary data for ease of type-based marshalling and unmarshalling.
func (*RawData) Descriptor
deprecated
func (*RawData) ProtoMessage ¶
func (*RawData) ProtoMessage()
func (*RawData) ProtoReflect ¶
func (x *RawData) ProtoReflect() protoreflect.Message
type UUID ¶
type UUID struct { // Raw uuid bytes go here. Bin []byte `protobuf:"bytes,1,opt,name=bin,proto3" json:"bin,omitempty"` // contains filtered or unexported fields }
Wrapper type for UUID to make type-based marshalling and unmarshalling easier
func MustUUIDRandom ¶
func MustUUIDRandom() *UUID
Generate a new random UUID using google's UUID implementation.
func NewUUIDRandom ¶
Generate a new random UUID using google's UUID implementation.
func UUIDFromGoogle ¶
func UUIDFromGoogle(value googleUUID.UUID) *UUID
Create a new protobuf UUID value from a Google UUID value.
func UUIDFromMongo ¶
Create a new protobuf UUID value from a Mongo UUID value.
func (*UUID) Descriptor
deprecated
func (*UUID) MustGoogle ¶
func (x *UUID) MustGoogle() googleUUID.UUID
As .ToGoogle(), but panics on conversion error.
func (*UUID) ProtoMessage ¶
func (*UUID) ProtoMessage()
func (*UUID) ProtoReflect ¶
func (x *UUID) ProtoReflect() protoreflect.Message
func (*UUID) ToGoogle ¶
func (x *UUID) ToGoogle() (googleUUID.UUID, error)
Converts cereal UUID value into google UUID value. Returns zero value if message pointer is nil.
func (*UUID) ToMongo ¶
Converts cereal UUID value into mongo helper UUID value (NOT the binary primitive value).