unit

package
v0.1.74 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ByteSizeFormatFloat = DefaultByteSizeFormatFloat

Functions

func DefaultByteSizeFormatFloat

func DefaultByteSizeFormatFloat(f float64) string

Types

type ByteSize

type ByteSize int64
const (
	B  ByteSize = 1
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
)

func NewByteSize

func NewByteSize(n float64, unit ByteSize) ByteSize

func ParseByteSize

func ParseByteSize(s string) (ByteSize, error)

func (ByteSize) MarshalText

func (b ByteSize) MarshalText() ([]byte, error)

func (ByteSize) String

func (n ByteSize) String() string

func (*ByteSize) UnmarshalText

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

Jump to

Keyboard shortcuts

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