Documentation
¶
Index ¶
- func Bool(b bool) *wrapperspb.BoolValue
- func Bytes(b []byte) *wrapperspb.BytesValue
- func Double(f float64) *wrapperspb.DoubleValue
- func Duration(d time.Duration) *durationpb.Duration
- func FromJSON(content []byte, out proto.Message) error
- func FromMap(in map[string]interface{}, out proto.Message) error
- func FromYAML(content []byte, pb proto.Message) error
- func IsEmpty(message proto.Message) bool
- func MarshalAnyDeterministic(pb proto.Message) (*any.Any, error)
- func Merge(dst, src proto.Message)
- func MergeAnys(dst *any.Any, src *any.Any) (*any.Any, error)
- func MustMarshalAny(pb proto.Message) *any.Any
- func MustMarshalJSON(in proto.Message) []byte
- func MustNewValueForStruct(in interface{}) *structpb.Value
- func MustStruct(in map[string]interface{}) *structpb.Struct
- func MustTimestampFromProto(ts *timestamppb.Timestamp) *time.Time
- func MustTimestampProto(t time.Time) *timestamppb.Timestamp
- func MustToStruct(message proto.Message) *structpb.Struct
- func MustUnmarshalJSON(content []byte, out proto.Message) proto.Message
- func NewValueForStruct(in interface{}) (*structpb.Value, error)
- func Now() *timestamppb.Timestamp
- func String(s string) *wrapperspb.StringValue
- func Struct(in map[string]interface{}) (*structpb.Struct, error)
- func ToJSON(pb proto.Message) ([]byte, error)
- func ToJSONIndent(pb proto.Message, indent string) ([]byte, error)
- func ToMap(pb proto.Message) (map[string]interface{}, error)
- func ToStruct(message proto.Message) (*structpb.Struct, error)
- func ToTyped(protoStruct *structpb.Struct, message proto.Message) error
- func ToYAML(pb proto.Message) ([]byte, error)
- func UInt32(u uint32) *wrapperspb.UInt32Value
- func UInt64(u uint64) *wrapperspb.UInt64Value
- func UnmarshalAnyTo(src *anypb.Any, dst proto2.Message) error
- func UnmarshalAnyToV2(src *anypb.Any, dst proto.Message) error
- type MergeFunction
- type OptionFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶ added in v1.8.1
func Bool(b bool) *wrapperspb.BoolValue
func Bytes ¶ added in v1.8.1
func Bytes(b []byte) *wrapperspb.BytesValue
func Double ¶ added in v1.8.1
func Double(f float64) *wrapperspb.DoubleValue
func MarshalAnyDeterministic ¶
When saving Snapshot in SnapshotCache we generate version based on proto.Equal() Therefore we need deterministic way of marshaling Any which is part of the Protobuf on which we execute Equal()
Based on proto.MarshalAny
func MergeAnys ¶
MergeAnys merges two Any messages of the same type. We cannot just use proto#Merge on Any directly because values are encoded in byte slices. Instead we have to unmarshal types, merge them and marshal again.
func MustMarshalJSON ¶ added in v1.8.1
func MustNewValueForStruct ¶ added in v1.8.1
func MustStruct ¶ added in v1.8.1
func MustTimestampFromProto ¶
func MustTimestampFromProto(ts *timestamppb.Timestamp) *time.Time
func MustTimestampProto ¶
func MustTimestampProto(t time.Time) *timestamppb.Timestamp
func MustUnmarshalJSON ¶ added in v1.8.1
func NewValueForStruct ¶ added in v1.8.1
func Now ¶ added in v1.8.1
func Now() *timestamppb.Timestamp
func String ¶ added in v1.8.1
func String(s string) *wrapperspb.StringValue
func ToJSONIndent ¶ added in v1.8.1
func UInt32 ¶ added in v1.8.1
func UInt32(u uint32) *wrapperspb.UInt32Value
func UInt64 ¶ added in v1.8.1
func UInt64(u uint64) *wrapperspb.UInt64Value
Types ¶
type MergeFunction ¶ added in v1.8.1
type MergeFunction func(dst, src protoreflect.Message)
var ReplaceMergeFn MergeFunction = func(dst, src protoreflect.Message) { dst.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { dst.Clear(fd) return true }) src.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { dst.Set(fd, v) return true }) }
ReplaceMergeFn instead of merging all subfields one by one, takes src and set it to dest
type OptionFn ¶ added in v1.8.1
type OptionFn func(options mergeOptions) mergeOptions
func MergeFunctionOptionFn ¶ added in v1.8.1
func MergeFunctionOptionFn(name protoreflect.FullName, function MergeFunction) OptionFn
Click to show internal directories.
Click to hide internal directories.