Documentation
¶
Index ¶
- type Timestamp
- func (ts *Timestamp) AppendFormat(b []byte, layout string) []byte
- func (x *Timestamp) AsTime() time.Time
- func (x *Timestamp) CheckValid() error
- func (ts *Timestamp) Format(layout string) string
- func (x *Timestamp) IsValid() bool
- func (ts *Timestamp) IsZero() (zero bool)
- func (ts *Timestamp) MarshalJSON() ([]byte, error)
- func (ts *Timestamp) MarshalProtobuf(dst []byte) []byte
- func (ts *Timestamp) MarshalText() ([]byte, error)
- func (ts *Timestamp) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
- func (ts *Timestamp) Proto()
- func (*Timestamp) ProtoMessage()
- func (x *Timestamp) Reset()
- func (ts *Timestamp) Scan(src interface{}) error
- func (ts *Timestamp) String() string
- func (ts *Timestamp) UnmarshalJSON(data []byte) error
- func (ts *Timestamp) UnmarshalProtobuf(src []byte) (err error)
- func (ts *Timestamp) UnmarshalText(data []byte) error
- func (ts *Timestamp) UnmarshalXML(dec *xml.Decoder, st xml.StartElement) error
- func (ts *Timestamp) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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"`
}
Timestamp is a wrapped timestamppb.Timestamp with proper JSON and XML marshaling (as string date).
func Now ¶ added in v0.3.0
func Now() *Timestamp
Now constructs a new Timestamp from the current time.
func (*Timestamp) CheckValid ¶ added in v0.3.0
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) IsValid ¶ added in v0.3.0
IsValid reports whether the timestamp is valid. It is equivalent to CheckValid == nil.
func (*Timestamp) MarshalJSON ¶
func (*Timestamp) MarshalProtobuf ¶ added in v0.3.0
MarshalProtobuf marshals ts into protobuf message, appends this message to dst and returns the result.
This function doesn't allocate memory on repeated calls.
func (*Timestamp) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.
func (*Timestamp) MarshalXML ¶
func (*Timestamp) ProtoMessage ¶ added in v0.3.0
func (*Timestamp) ProtoMessage()
func (*Timestamp) UnmarshalJSON ¶
func (*Timestamp) UnmarshalProtobuf ¶ added in v0.3.0
UnmarshalProtobuf unmarshals ts from protobuf message at src.
func (*Timestamp) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.