model

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeOrDurationValue

type TimeOrDurationValue struct {
	Time *time.Time
	Dur  *model.Duration
}

TimeOrDurationValue is a custom kingping parser for time in RFC3339 or duration in Go's duration format, such as "300ms", "-1.5h" or "2h45m". Only one will be set.

func TimeOrDuration

func TimeOrDuration(flags *kingpin.FlagClause) *TimeOrDurationValue

TimeOrDuration helper for parsing TimeOrDuration with kingpin.

func (*TimeOrDurationValue) PrometheusTimestamp

func (tdv *TimeOrDurationValue) PrometheusTimestamp() int64

PrometheusTimestamp returns TimeOrDurationValue converted to PrometheusTimestamp if duration is set now+duration is converted to Timestamp.

func (*TimeOrDurationValue) Set

func (tdv *TimeOrDurationValue) Set(s string) error

Set converts string to TimeOrDurationValue.

func (*TimeOrDurationValue) String

func (tdv *TimeOrDurationValue) String() string

String returns either time or duration.

Jump to

Keyboard shortcuts

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