pbutil

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON2ProtoMessage added in v1.3.0

func JSON2ProtoMessage(raw []byte, message proto.Message) error

JSON2ProtoMessage unmarshal json to protobuf message

func NewDuration

func NewDuration(d time.Duration) *durationpb.Duration

NewDuration create protobuf duration by time.Duration

func NewTimestamp

func NewTimestamp(ts *time.Time) (*timestamppb.Timestamp, error)

NewTimestamp create protobuf timestamp by time.Time

func ParseDuration

func ParseDuration(duration *durationpb.Duration) (time.Duration, error)

ParseDuration get time.Duration from protobuf duration

func ParseTimestamp

func ParseTimestamp(timestamp *timestamppb.Timestamp, location ...*time.Location) (*time.Time, error)

ParseTimestamp get time.Time from protobuf timestamp

func ProtoMessage2JSON

func ProtoMessage2JSON(message proto.Message) (json.RawMessage, error)

ProtoMessage2JSON marshal protobuf message to json message

Types

This section is empty.

Jump to

Keyboard shortcuts

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