Documentation ¶
Index ¶
- func DurationFromDays(d int32) *durationpb.Duration
- func DurationFromHours(h int64) *durationpb.Duration
- func DurationFromMinutes(m int64) *durationpb.Duration
- func DurationFromSeconds(s int64) *durationpb.Duration
- func DurationPtr(td time.Duration) *durationpb.Duration
- func DurationValue(d *durationpb.Duration) time.Duration
- func MinDurationPtr(d1 *durationpb.Duration, d2 *durationpb.Duration) *durationpb.Duration
- func ParseDuration(s string) (time.Duration, error)
- func ParseDurationDefaultDays(s string) (time.Duration, error)
- func ParseDurationDefaultSeconds(s string) (time.Duration, error)
- func ParseHHMMSSDuration(d string) (time.Duration, error)
- func TimeNowPtrUtc() *timestamppb.Timestamp
- func TimeNowPtrUtcAddDuration(t time.Duration) *timestamppb.Timestamp
- func TimeNowPtrUtcAddSeconds(seconds int) *timestamppb.Timestamp
- func TimePtr(t time.Time) *timestamppb.Timestamp
- func TimeValue(t *timestamppb.Timestamp) time.Time
- func TimeValuePtr(t *timestamppb.Timestamp) *time.Time
- func UnixOrZeroTime(nanos int64) time.Time
- func UnixOrZeroTimePtr(nanos int64) *timestamppb.Timestamp
- func ValidateProtoDuration(d *durationpb.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationFromDays ¶ added in v0.28.0
func DurationFromDays(d int32) *durationpb.Duration
func DurationFromHours ¶ added in v0.28.0
func DurationFromHours(h int64) *durationpb.Duration
func DurationFromMinutes ¶ added in v0.28.0
func DurationFromMinutes(m int64) *durationpb.Duration
func DurationFromSeconds ¶ added in v0.28.0
func DurationFromSeconds(s int64) *durationpb.Duration
func DurationPtr ¶ added in v0.28.0
func DurationPtr(td time.Duration) *durationpb.Duration
func DurationValue ¶ added in v0.28.0
func DurationValue(d *durationpb.Duration) time.Duration
func MinDurationPtr ¶ added in v0.28.0
func MinDurationPtr(d1 *durationpb.Duration, d2 *durationpb.Duration) *durationpb.Duration
func ParseDuration ¶ added in v1.11.0
ParseDuration is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours).
func ParseDurationDefaultDays ¶ added in v1.11.0
ParseDurationDefaultDays is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours), and also supports unit-less numbers, which are interpreted as days.
func ParseDurationDefaultSeconds ¶ added in v1.21.0
ParseDurationDefaultSeconds is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours), and also supports unit-less numbers, which are interpreted as seconds.
func ParseHHMMSSDuration ¶ added in v1.23.0
func TimeNowPtrUtc ¶ added in v0.28.0
func TimeNowPtrUtc() *timestamppb.Timestamp
func TimeNowPtrUtcAddDuration ¶ added in v0.28.0
func TimeNowPtrUtcAddDuration(t time.Duration) *timestamppb.Timestamp
func TimeNowPtrUtcAddSeconds ¶ added in v0.28.0
func TimeNowPtrUtcAddSeconds(seconds int) *timestamppb.Timestamp
func TimeValuePtr ¶ added in v1.25.0
func TimeValuePtr(t *timestamppb.Timestamp) *time.Time
func UnixOrZeroTime ¶ added in v0.28.0
func UnixOrZeroTimePtr ¶ added in v0.28.0
func UnixOrZeroTimePtr(nanos int64) *timestamppb.Timestamp
func ValidateProtoDuration ¶ added in v1.26.2
func ValidateProtoDuration(d *durationpb.Duration) error
ValidateProtoDuration checks protobuf durations for two conditions:
- the seconds and nanos fields have the same sign (to avoid serialization issues)
- the golang representation of the duration is not negative
nil durations are considered valid because they will be treated as the zero value. durationpb.CheckValid cannot be used directly because it will return an error for very large durations but we are okay with truncating these. durationpb.AsDuration() caps the upper bound for timers at 10,000 years to prevent overflow.
Types ¶
This section is empty.