unit

package
v0.0.0-...-e89c278 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MPL-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Byte = 1
	KB   = 1024 * Byte
	MB   = 1024 * KB
	GB   = 1024 * MB
	TB   = 1024 * GB
	PB   = 1024 * TB
	EB   = 1024 * PB
)
View Source
const (
	Kb = 1024 * bits
	Mb = 1024 * Kb
	Gb = 1024 * Mb
	Tb = 1024 * Gb
	Pb = 1024 * Tb
	Eb = 1024 * Pb
)

Variables

This section is empty.

Functions

func Duration2Str

func Duration2Str(t time.Duration) string

func Duration2StrWithLanguage

func Duration2StrWithLanguage(t time.Duration, languageCode language.LanguageCode) string

func Flow2B

func Flow2B(fileSize int64) (size string)

func Flow2Str

func Flow2Str(fileSize int64) (size string)

func FormatInt64

func FormatInt64(val int64, prec int) string

func GetUnitCode2Show

func GetUnitCode2Show(unitCode UnitCode, languageCode language.LanguageCode) string

func Size2B

func Size2B(fileSize int64) string

func Size2Str

func Size2Str(fileSize int64) string

func Size2b

func Size2b(fileSize int64) string

func Speed2Bs

func Speed2Bs(speed float64) string

func Speed2Str

func Speed2Str(speed float64) string

func Speed2bps

func Speed2bps(speed float64) string

Types

type UnitCode

type UnitCode string
const (
	Day         UnitCode = "day"
	Hour        UnitCode = "hour"
	Minute      UnitCode = "minute"
	Second      UnitCode = "second"
	Millisecond UnitCode = "millisecond"
)

Jump to

Keyboard shortcuts

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