Back to godoc.org

Package clockflag

v0.0.0-...-d4769a7
Latest Go to latest

The latest major version is .

Published: Aug 1, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Index

Constants

const DurationHelp = "A duration string is a sequence of <number><unit> such as 2h15m. " +
	"Supported units are 'ns', 'us'/'µs', 'ms', 's', 'm', and 'h'."

DurationHelp is generic Duration help.

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a time.Duration into a string that can be parsed with ParseDuration.

type Duration

type Duration time.Duration

Duration is a Flag- and JSON-compatible Duration value.

func ParseDuration

func ParseDuration(v string) (Duration, error)

ParseDuration parses a clockflag Duration from a string. This is basically a typed fall-through to time.ParseDuration.

func (Duration) IsZero

func (d Duration) IsZero() bool

IsZero tests if this Duration is the zero value.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Marshals a Duration into a duration string.

func (*Duration) Set

func (d *Duration) Set(value string) (err error)

Set implements flag.Value.

func (*Duration) String

func (d *Duration) String() string

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Unmarshals a JSON entry into the underlying type. The entry is expected to contain a string corresponding to one of the enum's keys.

type Time

type Time time.Time

Time is a flag- and JSON-compatible Time which parses from RFC3339 strings.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Marshals a Time into an RFC3339 time string.

func (*Time) Set

func (t *Time) Set(value string) error

Set implements flag.Value.

func (*Time) String

func (t *Time) String() string

func (Time) Time

func (t Time) Time() time.Time

Time returns the Time value associated with this Time.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Unmarshals a JSON entry into the underlying type. The entry is expected to contain a string corresponding to one of the enum's keys.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier