unit

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package unit provides utilities for parsing and handling various units of measurement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes int64

Bytes represents the size in bytes.

func (Bytes) String

func (b Bytes) String() string

String implements fmt.Stringer.

func (*Bytes) UnmarshalText

func (b *Bytes) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

It is needed for Kong: https://pkg.go.dev/github.com/alecthomas/kong#readme-custom-decoders-mappers

type Duration

type Duration time.Duration

Duration is a wrapper around time.Duration that supports parsing days.

func (Duration) String

func (d Duration) String() string

String implements fmt.Stringer.

func (*Duration) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

It is needed for Kong: https://pkg.go.dev/github.com/alecthomas/kong#readme-custom-decoders-mappers

type Percentage added in v0.2.0

type Percentage int

Percentage represents the number of percents.

func (Percentage) String added in v0.2.0

func (p Percentage) String() string

String implements fmt.Stringer.

func (*Percentage) UnmarshalText added in v0.2.0

func (p *Percentage) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

It is needed for Kong: https://pkg.go.dev/github.com/alecthomas/kong#readme-custom-decoders-mappers

Jump to

Keyboard shortcuts

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