timestamppb

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {

	// Represents seconds of UTC time since Unix epoch
	// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
	// 9999-12-31T23:59:59Z inclusive.
	Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
	// Non-negative fractions of a second at nanosecond resolution. Negative
	// second values with fractions must still have non-negative nanos values
	// that count forward in time. Must be from 0 to 999,999,999
	// inclusive.
	Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(t time.Time) *Timestamp

New constructs a new Timestamp from the provided time.Time.

func Now

func Now() *Timestamp

Now constructs a new Timestamp from the current time.

func (*Timestamp) AsTime

func (x *Timestamp) AsTime() time.Time

AsTime converts x to a time.Time.

func (*Timestamp) CheckValid

func (x *Timestamp) CheckValid() error

CheckValid returns an error if the timestamp is invalid. In particular, it checks whether the value represents a date that is in the range of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. An error is reported for a nil Timestamp.

func (*Timestamp) GetNanos

func (x *Timestamp) GetNanos() int32

func (*Timestamp) GetSeconds

func (x *Timestamp) GetSeconds() int64

func (*Timestamp) IsValid

func (x *Timestamp) IsValid() bool

IsValid reports whether the timestamp is valid. It is equivalent to CheckValid == nil.

func (*Timestamp) MarshalToSizedBufferVT

func (m *Timestamp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Timestamp) MarshalToVT

func (m *Timestamp) MarshalToVT(dAtA []byte) (int, error)

func (*Timestamp) MarshalVT

func (m *Timestamp) MarshalVT() (dAtA []byte, err error)

func (*Timestamp) ProtoReflect

func (x *Timestamp) ProtoReflect() protoreflect.Message

func (*Timestamp) SizeVT

func (m *Timestamp) SizeVT() (n int)

func (*Timestamp) UnmarshalVT

func (m *Timestamp) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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