Documentation ¶
Overview ¶
Package google contains utility methods to help interface between Google standard protobufs and native Go types.
Index ¶
- func DurationFromProto(d *durationpb.Duration) time.Duration
- func LoadDuration(d *durationpb.Duration, v time.Duration) *durationpb.Duration
- func LoadTimestamp(t *timestamppb.Timestamp, v time.Time) *timestamppb.Timestamp
- func NewDuration(v time.Duration) *durationpb.Duration
- func NewTimestamp(v time.Time) *timestamppb.Timestamp
- func TimeFromProto(t *timestamppb.Timestamp) time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationFromProto ¶
func DurationFromProto(d *durationpb.Duration) time.Duration
DurationFromProto returns the time.Duration associated with a Duration protobuf.
func LoadDuration ¶
func LoadDuration(d *durationpb.Duration, v time.Duration) *durationpb.Duration
LoadDuration replaces the value in the supplied Duration with the specified value.
If the supplied Duration is nil and the value is non-zero, a new Duration will be generated. The populated Duration will be returned.
func LoadTimestamp ¶
func LoadTimestamp(t *timestamppb.Timestamp, v time.Time) *timestamppb.Timestamp
LoadTimestamp replaces the value in the supplied Timestamp with the specified time.
If the supplied Timestamp is nil and the time is non-zero, a new Timestamp will be generated. The populated Timestamp will be returned.
func NewDuration ¶
func NewDuration(v time.Duration) *durationpb.Duration
NewDuration creates a new Duration protobuf from a time.Duration.
func NewTimestamp ¶
func NewTimestamp(v time.Time) *timestamppb.Timestamp
NewTimestamp creates a new Timestamp protobuf from a time.Time type.
func TimeFromProto ¶
func TimeFromProto(t *timestamppb.Timestamp) time.Time
TimeFromProto returns the time.Time associated with a Timestamp protobuf.
Types ¶
This section is empty.