timestampmagic

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsTime

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

AsTime returns the time.Time value of the timestamp. It works like timestamppb.Timestamp.AsTime, but it treats an empty timestamp as a zero time. Please note that it doesn't support "1970-01-01 00:00:00" and returns time.Time{} instead.

func IsZero

func IsZero(ts *timestamppb.Timestamp) bool

IsZero returns true if the timestamp is zero or the time is zero.

func IsZeroTime

func IsZeroTime(ts *timestamppb.Timestamp) bool

IsZeroTime returns true if the time is zero. Use IsZero instead if you don't have a specific reason.

func IsZeroTimestamp

func IsZeroTimestamp(ts *timestamppb.Timestamp) bool

IsZeroTimestamp returns true if the timestamp is zero. Use IsZero instead if you don't have a specific reason.

func New

New returns a new timestamppb.Timestamp. It works like timestamppb.New, but it treats zero time as an empty timestamp.

Types

This section is empty.

Jump to

Keyboard shortcuts

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