types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration time.Duration

Duration is a custom type suitable for parsing duration values. It supports `time.ParseDuration`-compatible values and suffix-less digits; in the latter case, seconds are assumed.

func (Duration) MarshalJSON

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

MarshalJSON serializes the given duration value.

func (Duration) MarshalText

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

MarshalText serialize the given duration value into a text.

func (*Duration) Set

func (d *Duration) Set(s string) error

Set sets the duration from the given string value.

func (Duration) String

func (d Duration) String() string

String returns a string representation of the duration value.

func (*Duration) UnmarshalJSON

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

UnmarshalJSON deserializes the given text into a duration value.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText deserializes the given text into a duration value. It is meant to support TOML decoding of durations.

Jump to

Keyboard shortcuts

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