util

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	time.Duration
}

func MustParseDuration

func MustParseDuration(v any) *Duration

MustParseDuration is like ParseDuration but panics if the expression cannot be parsed. It simplifies safe initialization of global variables holding durations Same idea than regexp.MustCompile

func ParseDuration

func ParseDuration(v any) (*Duration, error)

Compile parses a duration and returns, if successful, a Duration object.

func (Duration) MarshalJSON

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

func (Duration) MarshalTOML

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

func (*Duration) MarshalText

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

func (*Duration) ParseDuration

func (d *Duration) ParseDuration(v any) error

func (*Duration) UnmarshalJSON

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

func (*Duration) UnmarshalTOML

func (d *Duration) UnmarshalTOML(v any) error

func (*Duration) UnmarshalText

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

Jump to

Keyboard shortcuts

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