formatting

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(val uint64) string

Count takes a number and prints it in a human readable format, e.g. 1000 -> 1k, 1000000 -> 1M, 1000000000 -> 1G

func CountSmall

func CountSmall(val uint64, align bool) string

CountSmall is like Count, but formats numbers smaller than 1000 as integers

func Duration

func Duration(d time.Duration) string

Duration prints out d in a human-readable duration format

func Size

func Size(size uint64) string

Size prints out size in a human-readable format (e.g. 10 MB)

func SizeSmall

func SizeSmall(size uint64, align bool) string

SizeSmall prints out size in a human-readable format (e.g. 10 MB) just like Size, but makes sure that sizes under 1024 Byte are formatted as integers

Types

type Countable

type Countable uint64

Countable is a uint64 that can be printed in a human readable format

func (Countable) String

func (c Countable) String() string

String prints the Countable in a human readable format

type Durationable

type Durationable time.Duration

Durationable is a time.Duration that can be printed in a human readable format and will prepend 'd' for 'days' in case the duration is above 24 hours

func (Durationable) String

func (d Durationable) String() string

type Sizeable

type Sizeable uint64

Sizeable is a number of bytes that can be printed in a human readable format

func (Sizeable) String

func (s Sizeable) String() string

String prints the Sizeable in a human readable format

Jump to

Keyboard shortcuts

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