types

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionalDuration

type OptionalDuration struct {
	Value    time.Duration
	HasValue bool
}

OptionalDuration is a config option that can be either set to a time.Duration, or a false value via the string "false" or an empty value.

Compared to the standard library duration, the parsing of this duration also supports more units:

- "d" for "24h" - "w" for "7d" - "M" for "30d" - "y" for "365d"

func NewOptionalDuration

func NewOptionalDuration(dur time.Duration) OptionalDuration

func (OptionalDuration) Duration

func (o OptionalDuration) Duration() (time.Duration, bool)

func (*OptionalDuration) Set

func (o *OptionalDuration) Set(v string) error

Set implements pflag.Value.

func (OptionalDuration) String

func (o OptionalDuration) String() string

String implements pflag.Value.

func (OptionalDuration) Type

func (o OptionalDuration) Type() string

Type implements pflag.Value.

func (*OptionalDuration) UnmarshalText

func (o *OptionalDuration) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

Jump to

Keyboard shortcuts

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