Documentation
¶
Index ¶
- func Future(duration time.Duration) time.Time
- func NullTimeToTimestamp(nt mysql.NullTime) *timestamp.Timestamp
- func Past(duration time.Duration) time.Time
- func TimeToNullTime(t time.Time) mysql.NullTime
- func TimeToTimestamp(t time.Time) *timestamp.Timestamp
- func TimestampToNilOrTime(ts *timestamp.Timestamp) *time.Time
- func TimestampToNullTime(ts *timestamp.Timestamp) mysql.NullTime
- func TimestampToTime(ts *timestamp.Timestamp) time.Time
- type RunStop
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NullTimeToTimestamp ¶
NullTimeToTimestamp returns a protobuf Timestamp from a mysql.NullTime
func TimeToNullTime ¶
TimeToNullTime coverts a Time into a NullTime
func TimeToTimestamp ¶
TimeToTimestamp returns a protobuf Timestamp from a Time object
func TimestampToNilOrTime ¶
TimestampToNilOrTime returns a time.Time or nil (for JSON) from a protobuf Timestamp
func TimestampToNullTime ¶
TimestampToNullTime returns a mysql.NullTime from a protobuf Timestamp
Types ¶
type RunStop ¶
type RunStop interface {
Run()
Running() bool
Stop()
}
RunStop exposes a functions for running, stopping, and querying status of presumably a background job.
type Ticker ¶
type Ticker interface {
// Start this ticker sending time on it's channel.
Start() Ticker
// Reset this ticker by creating a new channel and sending time on it.
Reset()
// Stop this ticker and release underlying resources.
Stop()
// SetPeriod of this ticker to the passed duration. The ticker must be restarted
// after this change.
SetPeriod(period time.Duration)
// Channel that is used to send the 'ticks'
Channel() <-chan time.Time
}
Ticker sends the time, after a period, on it's channel once started.
func NewTicker ¶
NewTicker returns a new Ticker containing a channel that will send the time with a period specified by the duration argument once Started. It adjusts the intervals or drops ticks to make up for slow receivers. The duration d must be greater than zero; if not, NewTicker will panic. Stop the ticker to release associated resources.