timestamp

package
v0.0.0-...-5117fa9 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TimestampString

func TimestampString(ts *Timestamp) string

TimestampString returns the RFC 3339 string for valid Timestamps. For invalid Timestamps, it returns an error message in parentheses.

func TimestampToTime

func TimestampToTime(ts *Timestamp) (time.Time, error)

Timestamp converts a google.protobuf.Timestamp proto to a time.Time. It returns an error if the argument is invalid.

Unlike most Go functions, if Timestamp returns an error, the first return value is not the zero time.Time. Instead, it is the value obtained from the time.Unix function when passed the contents of the Timestamp, in the UTC locale. This may or may not be a meaningful time; many invalid Timestamps do map to valid time.Times.

A nil Timestamp returns an error. The first return value in that case is undefined.

Types

type Timestamp

type Timestamp timestamp.Timestamp

func TimeToTimestamp

func TimeToTimestamp(time time.Time) *Timestamp

no safe transform

func TimestampNow

func TimestampNow() *Timestamp

TimestampNow returns a google.protobuf.Timestamp for the current time.

func TimestampProto

func TimestampProto(t time.Time) (*Timestamp, error)

TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. It returns an error if the resulting Timestamp is invalid.

func (Timestamp) ImplementsGraphQLType

func (Timestamp) ImplementsGraphQLType(name string) bool

func (Timestamp) MarshalJSON

func (g Timestamp) MarshalJSON() ([]byte, error)

json support

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) Reset

func (t *Timestamp) Reset()

proto message

func (*Timestamp) Scan

func (g *Timestamp) Scan(src interface{}) error

database scan

func (*Timestamp) String

func (t *Timestamp) String() string

func (*Timestamp) ToTime

func (g *Timestamp) ToTime() (time.Time, error)

func (*Timestamp) UnmarshalGraphQL

func (t *Timestamp) UnmarshalGraphQL(input interface{}) error

func (Timestamp) Value

func (g Timestamp) Value() (driver.Value, error)

database Valuer Interface

Jump to

Keyboard shortcuts

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