protoutil

package
v2.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package protoutil contains some utilities for interacting with protocol buffer objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone[T proto.Message](x T) T

Clone clones a proto in a type-safe manner.

func MustTime

func MustTime(tspb *timestamppb.Timestamp) time.Time

MustTime converts a google.protobuf.Timestamp to a time.Time.

func MustTimestamp

func MustTimestamp(ts time.Time) *timestamppb.Timestamp

MustTimestamp converts a time.Time to a google.protobuf.Timestamp, or panics.

func MustTimestampFromPointer

func MustTimestampFromPointer(ts *time.Time) *timestamppb.Timestamp

MustTimestampFromPointer converts a *time.Time to a google.protobuf.Timestamp, or panics.

Types

type ProtoJSONDecoder

type ProtoJSONDecoder struct {
	// contains filtered or unexported fields
}

ProtoJSONDecoder decodes a concatenated stream of protocol buffer messages encoded as JSON.

func NewProtoJSONDecoder

func NewProtoJSONDecoder(r io.Reader, opts protojson.UnmarshalOptions) *ProtoJSONDecoder

func (*ProtoJSONDecoder) More

func (d *ProtoJSONDecoder) More() bool

func (*ProtoJSONDecoder) UnmarshalNext

func (d *ProtoJSONDecoder) UnmarshalNext(dst proto.Message) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL