format

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 2 Imported by: 181

Documentation

Overview

Package format provides convenience functions for formatting.

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeFormatSeconds    string = "02 Jan 2006 15:04:05 MST"
	TimeFormatSubseconds string = "02 Jan 2006 15:04:05.99 MST"
)

Functions

func Duration

func Duration(duration time.Duration) string

Duration is similar to the time.Duration.String method from the standard library but is more readable and shows only 3 digits of precision when duration is less than 1 minute.

func FormatBytes

func FormatBytes(bytes uint64) string

FormatBytes returns a string with the number of bytes specified converted into a human-friendly format with a binary multiplier (i.e. GiB).

func GetMiltiplier added in v0.3.3

func GetMiltiplier(value uint64) (uint, string)

GetMiltiplier will return the preferred base-2 multiplier (i.e. Ki, Mi, Gi) and right shift number for the specified vlaue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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