human

package
v0.3.5-rc3-hotfix1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSizeToHuman

func FormatSizeToHuman(bytes uint64) string

To human readable byte string like 20M, 18.7K, etc. Valid units:

e: Exabyte
p: Petabyte
t: Terabyte
g: Gigabyte
m: Megabyte
k: Kilobyte
b: Byte

The tesults falls to smallest number >= 1 of the unit.

func ParseSizeFromHuman

func ParseSizeFromHuman(s string) (uint64, error)

Types

type Interval

type Interval time.Duration

func MustParseInterval

func MustParseInterval(s string) Interval

func (Interval) IsZero

func (s Interval) IsZero() bool

func (Interval) MarshalYAML

func (s Interval) MarshalYAML() (interface{}, error)

func (Interval) String

func (s Interval) String() string

func (*Interval) UnmarshalYAML

func (s *Interval) UnmarshalYAML(unmarshal func(interface{}) error) error

func (Interval) Value

func (s Interval) Value() time.Duration

type Size

type Size uint64

func MustParseSize

func MustParseSize(s string) Size

func (*Size) IsZero

func (s *Size) IsZero() bool

func (Size) MarshalYAML

func (s Size) MarshalYAML() (interface{}, error)

func (Size) String

func (s Size) String() string

func (*Size) UnmarshalYAML

func (s *Size) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*Size) Value

func (s *Size) Value() int64

Jump to

Keyboard shortcuts

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