package
0.1.1
Repository: https://github.com/rdmrcv/go-protom.git
Documentation: pkg.go.dev

# README

Well Known Types

Protobuf have a set of so-called Well Known Types which provide complex types useful in many situations. These types require custom encode and decode functions. This set of types partially implemented in this package.

Empty Doc

Empty represent an empty object.

When encode we produce document start and end with nothing in between.

When decode we read document and throw an error if the document contain something.

Duration Doc

Represent a span of time.

When decode and encode we use the protojson. String field will be produced.

Timestamp Doc

Represent a time point.

When decode and encode we fallback to the default time.Time encode/decode function already presented in the bson.

Time in protojson and protobson packages differs from each other. The protobson uses a DateTime type from the mongo-driver which loose precision but better integrated into the MongoDB data model.

This behavior might be changed in future if it introduce incompatibility or precission loss.

Struct, Value, ListValue Doc

Represent a JSON object.

When decode and encode we work with int/float/double precision pretty loosely. This might be changed in future if this behavior will cause troubles.

Wrappers

Float Doc, Double Doc, Int32 Doc, Int64 Doc, UInt32 Doc, UInt64 Doc, Bool Doc, Bytes Doc, String Doc

Represent some regular types.

When decode and encode we work with int/float/double precision pretty loosely. This might be changed in future if this behavior will cause troubles.

# Functions

NewProtoDurationCodec returns a ProtoDurationCodec.
NewProtoEmptyCodec returns a ProtoEmptyCodec that uses p for struct tag parsing.
NewProtoStructCodec returns a ProtoStructCodec that uses p for struct tag parsing.
NewProtoStructListValueCodec returns a ProtoStructListValueCodec that uses p for struct tag parsing.
NewProtoStructValueCodec returns a ProtoStructValueCodec that uses p for struct tag parsing.
NewProtoTimestampCodec returns a ProtoEmptyCodec that uses p for struct tag parsing.
NewProtoWrappersCodec returns a ProtoWrappersCodec that uses p for struct tag parsing.

# Variables

No description provided by the author
No description provided by the author

# Structs

ProtoDurationCodec is the Codec used for google.protobuf.Duration type.
ProtoEmptyCodec is the Codec used for google.protobuf.Empty type.
ProtoStructCodec is the Codec used for google.protobuf.Struct type.
ProtoStructListValueCodec is the Codec used for google.protobuf.ListValue type.
ProtoStructValueCodec is the Codec used for google.protobuf.Value type.
ProtoTimestampCodec is the Codec used for google.protobuf.Timestamp type.
ProtoWrappersCodec is the Codec used for google.protobuf.Wrappers type.