Documentation ¶
Index ¶
- Constants
- func After(d time.Duration) <-chan time.Time
- func BackoffUntil(ctx context.Context, f func(ctx context.Context), backoff BackOff, ...)
- func BackoffUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, ...)
- func ConvertTimestamp(timestamp int64, from, to time.Duration) int64
- func Forever(f func(), period time.Duration)
- func ForeverWithReset(f func(), resetCh chan struct{}, period time.Duration)
- func Jitter(duration time.Duration, maxFactor float64) time.Duration
- func JitterBackOff(duration time.Duration, maxFactor float64) *jitterBackOff
- func JitterUntil(ctx context.Context, f func(ctx context.Context), sliding bool, ...)
- func JitterUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, ...)
- func LayoutStrftimeToSimilarTime(layout string) string
- func LayoutStrftimeToTime(layout string) string
- func LayoutTimeToSimilarStrftime(layout string) string
- func LayoutTimeToStrftime(layout string) string
- func NonSlidingUntil(ctx context.Context, f func(ctx context.Context), period time.Duration)
- func NonSlidingUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, ...)
- func RatioFrom(from time.Duration, to time.Duration) (ratio time.Duration, divide bool)
- func Timestamp(t time.Time, unit time.Duration) int64
- func TruncateByLocation(t time.Time, d time.Duration) time.Time
- func UnixWithUnit(timestamp int64, unit time.Duration) time.Time
- func Until(ctx context.Context, f func(ctx context.Context), period time.Duration)
- func UntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, ...)
- type BackOff
- type Cost
- type CostTick
- func (c CostTick) Costs() []time.Duration
- func (c CostTick) Format(s fmt.State, verb rune)
- func (c CostTick) Len() int
- func (c CostTick) Less(i, j int) bool
- func (c *CostTick) Reset()
- func (c *CostTick) Sort()
- func (c CostTick) String() string
- func (c *CostTick) Swap(i, j int)
- func (c *CostTick) Tick(msg string)
- func (c CostTick) Walk(f func(idx int, msg string, cost time.Duration, at time.Time) (next bool))
- type Duration
- type EmptyExponentialBackOffOption
- type ExponentialBackOff
- func (o *ExponentialBackOff) ApplyOptions(options ...ExponentialBackOffOption) *ExponentialBackOff
- func (o *ExponentialBackOff) GetCurrentInterval() time.Duration
- func (o *ExponentialBackOff) GetElapsedCount() int
- func (o *ExponentialBackOff) GetElapsedDuration() time.Duration
- func (o *ExponentialBackOff) GetInitialInterval() time.Duration
- func (o *ExponentialBackOff) GetMaxElapsedDuration() time.Duration
- func (o *ExponentialBackOff) GetMaxInterval() time.Duration
- func (o *ExponentialBackOff) GetMultiplier() float64
- func (o *ExponentialBackOff) GetRandomValueFromInterval(randomizationFactor float64, currentInterval time.Duration) time.Duration
- func (o *ExponentialBackOff) GetRandomizationFactor() float64
- func (o *ExponentialBackOff) NextBackOff() (backoff time.Duration, ok bool)
- func (o *ExponentialBackOff) Reset()
- func (o *ExponentialBackOff) SetDefault()
- type ExponentialBackOffOption
- func WithExponentialBackOffOptionGRPC() ExponentialBackOffOption
- func WithExponentialBackOffOptionInitialInterval(duration time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMaxElapsedCount(count int) ExponentialBackOffOption
- func WithExponentialBackOffOptionMaxElapsedDuration(duration time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMaxInterval(maxInterval time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMultiplier(multiplier float64) ExponentialBackOffOption
- func WithExponentialBackOffOptionNoLimit() ExponentialBackOffOption
- func WithExponentialBackOffOptionRandomizationFactor(factor float64) ExponentialBackOffOption
- type ExponentialBackOffOptionFunc
- type NonSlidingBackOff
- type StopBackOff
- type Timer
- type UnixSecondTime
- type UnixTime
- type UnixTimeDay
- type UnixTimeHour
- type UnixTimeMicrosecond
- type UnixTimeMillisecond
- type UnixTimeMinute
- type UnixTimeNanosecond
Constants ¶
const ( // DefaultInitialInterval The default initial interval value (0.5 seconds). DefaultInitialInterval = 500 * time.Millisecond // DefaultRandomizationFactor The default randomization factor (0.5 which results in a random period ranging between 50% // below and 50% above the retry interval). DefaultRandomizationFactor = 0.5 // DefaultMultiplier The default multiplier value (1.5 which is 50% increase per back off). DefaultMultiplier = 1.5 // DefaultMaxInterval The default maximum back off time (1 minute). DefaultMaxInterval = time.Minute // DefaultMaxElapsedDuration The default maximum elapsed time (15 minutes). DefaultMaxElapsedDuration = 15 * time.Minute // DefaultMaxElapsedCount The default maximum elapsed count (-1). DefaultMaxElapsedCount = -1 )
const ( // Deprecated: Use GLogDate instead. // See also https://github.com/google/glog/pull/530 GLogShortDate = "0102 15:04:05.000000" // mmdd hh:mm:ss.uuuuuu GLogDate = "20060102 15:04:05.000000" // yyyymmdd hh:mm:ss.uuuuuu )
const InfDuration = time.Duration(1<<63 - 1)
InfDuration is the duration returned by Delay when a Reservation is not OK.
const ZeroBackOff = NonSlidingBackOff(0)
ZeroBackOff Fixed back-off policy whose back-off time is always zero, meaning that the operation is retried
immediately without waiting.
Variables ¶
This section is empty.
Functions ¶
func BackoffUntil ¶
BackoffUntil loops until context is done, run f every duration given by BackoffManager. BackoffUntil is syntactic sugar on top of BackoffUntilWithReset, without resetCh.
func BackoffUntilWithReset ¶
func BackoffUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, backoff BackOff, sliding bool)
BackoffUntilWithReset loops until context is done, run f every duration given by BackoffManager.
If sliding is true, the period is computed after f runs. If it is false then period includes the runtime for f. backoff is reset if resetCh has data
func ConvertTimestamp ¶
ConvertTimestamp convert timestamp from one unit to another unit
func Forever ¶
Forever calls f every period for ever.
Forever is syntactic sugar on top of Forever, without resetCh. Example: time.Second 2021/04/09 12:45:08 Apr 9 12:45:08 2021/04/09 12:45:09 Apr 9 12:45:09 2021/04/09 12:45:10 Apr 9 12:45:10 2021/04/09 12:45:11 Apr 9 12:45:11 2021/04/09 12:45:12 Apr 9 12:45:12 2021/04/09 12:45:13 Apr 9 12:45:13 2021/04/09 12:45:14 Apr 9 12:45:14
func ForeverWithReset ¶
ForeverWithReset calls f every period for ever.
ForeverWithReset is syntactic sugar on top of UntilWithReset. Example: time.Second 2021/04/09 12:45:08 Apr 9 12:45:08 2021/04/09 12:45:09 Apr 9 12:45:09 2021/04/09 12:45:10 Apr 9 12:45:10 2021/04/09 12:45:11 Apr 9 12:45:11 2021/04/09 12:45:12 Apr 9 12:45:12 2021/04/09 12:45:13 Apr 9 12:45:13 2021/04/09 12:45:14 Apr 9 12:45:14
func Jitter ¶
Jitter returns a time.Duration between [duration - maxFactor*duration, duration + maxFactor*duration].
This allows clients to avoid converging on periodic behavior.
func JitterBackOff ¶
JitterBackOff returns a time.Duration between [duration - maxFactor*duration, duration + maxFactor*duration].
This allows clients to avoid converging on periodic behavior.
func JitterUntil ¶
func JitterUntil(ctx context.Context, f func(ctx context.Context), sliding bool, opts ...ExponentialBackOffOption)
JitterUntil loops until context is done, running f every period. JitterUntil is syntactic sugar on top of JitterUntilWithReset, without resetCh.
func JitterUntilWithReset ¶
func JitterUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, sliding bool, opts ...ExponentialBackOffOption)
JitterUntilWithReset loops until context is done, running f every period.
period set by WithExponentialBackOffOptionInitialInterval jitterFactor set by WithExponentialBackOffOptionRandomizationFactor If jitterFactor is positive, the period is jittered before every run of f. If jitterFactor is not positive, the period is unchanged and not jittered.
If sliding is true, the period is computed after f runs. If it is false then period includes the runtime for f. backoff is reset if resetCh has data
Cancel context to stop. f may not be invoked if context is already expired.
func LayoutStrftimeToTime ¶
func LayoutTimeToStrftime ¶
func NonSlidingUntil ¶
NonSlidingUntil loops until context is done, running f every period.
NonSlidingUntil is syntactic sugar on top of NonSlidingUntilWithReset, without resetCh.
func NonSlidingUntilWithReset ¶
func NonSlidingUntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, period time.Duration)
NonSlidingUntilWithReset loops until context is done, running f every period.
NonSlidingUntilWithReset is syntactic sugar on top of JitterUntilWithReset with zero jitter factor, with sliding = false (meaning the timer for period starts at the same time as the function starts). Example: time.Second for period and sleep in f 2021/04/09 12:45:08 Apr 9 12:45:08 2021/04/09 12:45:09 Apr 9 12:45:09 2021/04/09 12:45:10 Apr 9 12:45:10 2021/04/09 12:45:11 Apr 9 12:45:11 2021/04/09 12:45:12 Apr 9 12:45:12 2021/04/09 12:45:13 Apr 9 12:45:13 2021/04/09 12:45:14 Apr 9 12:45:14
func RatioFrom ¶
RatioFrom Example: ratio, divide := RatioFrom(fromUnit, toUnit)
if divide { toDuration = fromDuration / ratio fromDuration = toDuration * ratio } else {
toDuration = fromDuration * ratio fromDuration = toDuration / ratio }
func Timestamp ¶
Timestamp returns a Unix timestamp in unit from "January 1, 1970 UTC". The result is undefined if the Unix time cannot be represented by an int64. Which includes calling TimeUnixMilli on a zero Time is undefined.
See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information.
func TruncateByLocation ¶
TruncateByLocation only happens in local semantics, apparently. observed values for truncating given time with 24 Hour: before truncation: 2012-01-01 04:15:30 +0800 CST after truncation: 2012-01-01 00:00:00 +0800 CST
time.Truncate only happens in UTC semantics, apparently. observed values for truncating given time with 24 Hour:
before truncation: 2012-01-01 04:15:30 +0800 CST after truncation: 2011-12-31 08:00:00 +0800 CST
This is really annoying when we want to truncate in local time we take the apparent local time in the local zone, and pretend that it's in UTC. do our math, and put it back to the local zone
func UnixWithUnit ¶
UnixWithUnit returns the local Time corresponding to the given Unix time by unit
func Until ¶
Until loops until context is done, running f every period.
Until is syntactic sugar on top of UntilWithReset, without resetCh.
func UntilWithReset ¶
func UntilWithReset(ctx context.Context, f func(ctx context.Context), resetCh chan struct{}, period time.Duration)
UntilWithReset loops until context is done, running f every period.
UntilWithReset is syntactic sugar on top of JitterUntilWithReset with zero jitter factor and with sliding = true (which means the timer for period starts after the f completes). Example: time.Second for period and sleep in f 2021/04/09 12:48:03 Apr 9 12:48:03 2021/04/09 12:48:05 Apr 9 12:48:05 2021/04/09 12:48:07 Apr 9 12:48:07 2021/04/09 12:48:09 Apr 9 12:48:09 2021/04/09 12:48:11 Apr 9 12:48:11 2021/04/09 12:48:13 Apr 9 12:48:13
Types ¶
type BackOff ¶
type BackOff interface { // Reset to initial state. Reset() // NextBackOff Gets duration to wait before retrying the operation to // indicate that no retries should be made. // ok indicates that no more retries should be made, max duration is returned also. // Example usage: // var backOffDuration, ok = backoff.NextBackOff(); // if (!ok) { // // do not retry operation // } else { // // sleep for backOffDuration milliseconds and retry operation // } NextBackOff() (backoff time.Duration, ok bool) }
BackOff Code borrowed from https://github.com/googleapis/google-http-java-client/blob/master/google-http-client/ src/main/java/com/google/api/client/util/BackOff.java
type Cost ¶
type Cost struct {
// contains filtered or unexported fields
}
func (*Cost) ElapseFunc ¶
type CostTick ¶
type CostTick struct { // Lesser reports whether the element with duration i // must sort before the element with duration j. // sorting in decreasing order of cost if Lesser is nil // behaves like Less in sort.Interface Lesser func(i time.Duration, j time.Duration) bool // contains filtered or unexported fields }
type Duration ¶ added in v1.2.26
Duration is alias of time.Duration for marshal and unmarshal
func (Duration) MarshalJSON ¶ added in v1.2.26
func (Duration) MarshalText ¶ added in v1.2.26
func (*Duration) UnmarshalJSON ¶ added in v1.2.26
func (*Duration) UnmarshalText ¶ added in v1.2.26
type EmptyExponentialBackOffOption ¶
type EmptyExponentialBackOffOption struct{}
EmptyExponentialBackOffOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type ExponentialBackOff ¶
type ExponentialBackOff struct {
// contains filtered or unexported fields
}
ExponentialBackOff Code borrowed from https://github.com/googleapis/google-http-java-client/blob/master/google-http-client/ src/main/java/com/google/api/client/util/ExponentialBackOff.java
func NewDefaultExponentialBackOff ¶
func NewDefaultExponentialBackOff(opts ...ExponentialBackOffOption) *ExponentialBackOff
NewDefaultExponentialBackOff returns a backoff with default limit
func NewExponentialBackOff ¶
func NewExponentialBackOff(opts ...ExponentialBackOffOption) *ExponentialBackOff
NewExponentialBackOff returns a no limit backoff
func NewGrpcExponentialBackOff ¶
func NewGrpcExponentialBackOff(opts ...ExponentialBackOffOption) *ExponentialBackOff
NewGrpcExponentialBackOff is a backoff from configuration with the default values specified at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
This should be useful for callers who want to configure backoff with non-default values only for a subset of the options.
func (*ExponentialBackOff) ApplyOptions ¶
func (o *ExponentialBackOff) ApplyOptions(options ...ExponentialBackOffOption) *ExponentialBackOff
func (*ExponentialBackOff) GetCurrentInterval ¶
func (o *ExponentialBackOff) GetCurrentInterval() time.Duration
GetCurrentInterval Returns the current retry interval.
func (*ExponentialBackOff) GetElapsedCount ¶
func (o *ExponentialBackOff) GetElapsedCount() int
GetElapsedCount Returns the elapsed count since an {@link ExponentialBackOff} instance is created and is reset when {@link #reset()} is called.
func (*ExponentialBackOff) GetElapsedDuration ¶
func (o *ExponentialBackOff) GetElapsedDuration() time.Duration
GetElapsedDuration Returns the elapsed time since an {@link ExponentialBackOff} instance is created and is reset when {@link #reset()} is called. The elapsed time is computed using {@link System#nanoTime()}.
func (*ExponentialBackOff) GetInitialInterval ¶
func (o *ExponentialBackOff) GetInitialInterval() time.Duration
GetInitialInterval Returns the initial retry interval.
func (*ExponentialBackOff) GetMaxElapsedDuration ¶
func (o *ExponentialBackOff) GetMaxElapsedDuration() time.Duration
GetMaxElapsedDuration Returns the maximum elapsed time. If the time elapsed since an {@link ExponentialBackOff} instance is created goes past the max_elapsed_time then the method {@link #NextBackOff()} starts returning STOP. The elapsed time can be reset by calling
func (*ExponentialBackOff) GetMaxInterval ¶
func (o *ExponentialBackOff) GetMaxInterval() time.Duration
GetMaxInterval Returns the maximum value of the back off period. Once the current interval reaches this value it stops increasing.
func (*ExponentialBackOff) GetMultiplier ¶
func (o *ExponentialBackOff) GetMultiplier() float64
GetMultiplier Returns the value to multiply the current interval with for each retry attempt.
func (*ExponentialBackOff) GetRandomValueFromInterval ¶
func (o *ExponentialBackOff) GetRandomValueFromInterval( randomizationFactor float64, currentInterval time.Duration) time.Duration
GetRandomValueFromInterval Returns a random value from the interval [randomizationFactor * currentInterval, randomizationFactor * currentInterval].
func (*ExponentialBackOff) GetRandomizationFactor ¶
func (o *ExponentialBackOff) GetRandomizationFactor() float64
GetRandomizationFactor Returns the randomization factor to use for creating a range around the retry interval. A randomization factor of 0.5 results in a random period ranging between 50% below and 50% above the retry interval.
func (*ExponentialBackOff) NextBackOff ¶
func (o *ExponentialBackOff) NextBackOff() (backoff time.Duration, ok bool)
NextBackOff This method calculates the next back off interval using the formula: randomized_interval = retry_interval +/- (randomization_factor * retry_interval) Subclasses may override if a different algorithm is required.
func (*ExponentialBackOff) Reset ¶
func (o *ExponentialBackOff) Reset()
Reset Sets the interval back to the initial retry interval and restarts the timer.
func (*ExponentialBackOff) SetDefault ¶
func (o *ExponentialBackOff) SetDefault()
type ExponentialBackOffOption ¶
type ExponentialBackOffOption interface {
// contains filtered or unexported methods
}
A ExponentialBackOffOption sets options.
func WithExponentialBackOffOptionGRPC ¶
func WithExponentialBackOffOptionGRPC() ExponentialBackOffOption
func WithExponentialBackOffOptionInitialInterval ¶
func WithExponentialBackOffOptionInitialInterval(duration time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMaxElapsedCount ¶
func WithExponentialBackOffOptionMaxElapsedCount(count int) ExponentialBackOffOption
func WithExponentialBackOffOptionMaxElapsedDuration ¶
func WithExponentialBackOffOptionMaxElapsedDuration(duration time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMaxInterval ¶
func WithExponentialBackOffOptionMaxInterval(maxInterval time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMultiplier ¶
func WithExponentialBackOffOptionMultiplier(multiplier float64) ExponentialBackOffOption
func WithExponentialBackOffOptionNoLimit ¶
func WithExponentialBackOffOptionNoLimit() ExponentialBackOffOption
func WithExponentialBackOffOptionRandomizationFactor ¶
func WithExponentialBackOffOptionRandomizationFactor(factor float64) ExponentialBackOffOption
type ExponentialBackOffOptionFunc ¶
type ExponentialBackOffOptionFunc func(*ExponentialBackOff)
ExponentialBackOffOptionFunc wraps a function that modifies ExponentialBackOff into an implementation of the ExponentialBackOffOption interface.
type NonSlidingBackOff ¶
NonSlidingBackOff Fixed back-off policy whose back-off time is always const, meaning that the operation is retried after waiting every duration.
func (*NonSlidingBackOff) NextBackOff ¶
func (o *NonSlidingBackOff) NextBackOff() (backoff time.Duration, ok bool)
func (*NonSlidingBackOff) Reset ¶
func (o *NonSlidingBackOff) Reset()
type StopBackOff ¶
type StopBackOff struct{}
StopBackOff Fixed back-off policy that always returns {@code #STOP} for {@link #NextBackOff()}, meaning that the operation should not be retried.
func (*StopBackOff) NextBackOff ¶
func (o *StopBackOff) NextBackOff() (backoff time.Duration, ok bool)
func (*StopBackOff) Reset ¶
func (o *StopBackOff) Reset()
type Timer ¶
Timer to fix time: Timer.Stop documentation example easily leads to deadlocks https://github.com/golang/go/issues/27169
func (*Timer) Reset ¶
Reset changes the timer to expire after duration d. Reset can be invoked anytime, which enhances std time.Reset Reset == std [Stop + drain + Reset] It returns true if the timer had been active, false if the timer had expired or been stopped.
func (*Timer) Stop ¶
Stop prevents the Timer from firing, with the channel drained. Stop ensures the channel is empty after a call to Stop. Stop == std [Stop + drain] It returns true if the call stops the timer, false if the timer has already expired or been stopped. Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.
type UnixSecondTime ¶
func (UnixSecondTime) MarshalJSON ¶
func (t UnixSecondTime) MarshalJSON() ([]byte, error)
func (UnixSecondTime) MarshalText ¶
func (t UnixSecondTime) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixSecondTime) String ¶
func (t UnixSecondTime) String() string
func (*UnixSecondTime) UnmarshalJSON ¶
func (t *UnixSecondTime) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixSecondTime) UnmarshalText ¶
func (t *UnixSecondTime) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTime ¶
type UnixTime = UnixSecondTime
type UnixTimeDay ¶
func (UnixTimeDay) MarshalJSON ¶
func (t UnixTimeDay) MarshalJSON() ([]byte, error)
func (UnixTimeDay) MarshalText ¶
func (t UnixTimeDay) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeDay) String ¶
func (t UnixTimeDay) String() string
func (*UnixTimeDay) UnmarshalJSON ¶
func (t *UnixTimeDay) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeDay) UnmarshalText ¶
func (t *UnixTimeDay) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTimeHour ¶
func (UnixTimeHour) MarshalJSON ¶
func (t UnixTimeHour) MarshalJSON() ([]byte, error)
func (UnixTimeHour) MarshalText ¶
func (t UnixTimeHour) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeHour) String ¶
func (t UnixTimeHour) String() string
func (*UnixTimeHour) UnmarshalJSON ¶
func (t *UnixTimeHour) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeHour) UnmarshalText ¶
func (t *UnixTimeHour) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTimeMicrosecond ¶
func (UnixTimeMicrosecond) MarshalJSON ¶
func (t UnixTimeMicrosecond) MarshalJSON() ([]byte, error)
func (UnixTimeMicrosecond) MarshalText ¶
func (t UnixTimeMicrosecond) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeMicrosecond) String ¶
func (t UnixTimeMicrosecond) String() string
func (*UnixTimeMicrosecond) UnmarshalJSON ¶
func (t *UnixTimeMicrosecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeMicrosecond) UnmarshalText ¶
func (t *UnixTimeMicrosecond) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTimeMillisecond ¶
func (UnixTimeMillisecond) MarshalJSON ¶
func (t UnixTimeMillisecond) MarshalJSON() ([]byte, error)
func (UnixTimeMillisecond) MarshalText ¶
func (t UnixTimeMillisecond) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeMillisecond) String ¶
func (t UnixTimeMillisecond) String() string
func (*UnixTimeMillisecond) UnmarshalJSON ¶
func (t *UnixTimeMillisecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeMillisecond) UnmarshalText ¶
func (t *UnixTimeMillisecond) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTimeMinute ¶
func (UnixTimeMinute) MarshalJSON ¶
func (t UnixTimeMinute) MarshalJSON() ([]byte, error)
func (UnixTimeMinute) MarshalText ¶
func (t UnixTimeMinute) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeMinute) String ¶
func (t UnixTimeMinute) String() string
func (*UnixTimeMinute) UnmarshalJSON ¶
func (t *UnixTimeMinute) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeMinute) UnmarshalText ¶
func (t *UnixTimeMinute) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
type UnixTimeNanosecond ¶
func (UnixTimeNanosecond) MarshalJSON ¶
func (t UnixTimeNanosecond) MarshalJSON() ([]byte, error)
func (UnixTimeNanosecond) MarshalText ¶
func (t UnixTimeNanosecond) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in Unix Seconds, with sub-second precision added if present.
func (UnixTimeNanosecond) String ¶
func (t UnixTimeNanosecond) String() string
func (*UnixTimeNanosecond) UnmarshalJSON ¶
func (t *UnixTimeNanosecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.
func (*UnixTimeNanosecond) UnmarshalText ¶
func (t *UnixTimeNanosecond) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.
Source Files ¶
- backoff.go
- convert.go
- cost.go
- delay.go
- duration.go
- exponentialbackoff.options.go
- exponentialbackoff_options.go
- format.go
- sleep.go
- strftime.go
- strftime_tables.go
- time.go
- time_unsafe.go
- unix_time_day.go
- unix_time_hour.go
- unix_time_micro.go
- unix_time_milli.go
- unix_time_minute.go
- unix_time_nano.go
- unix_time_second.go
- wait.go