units

package
v0.0.0-...-504ad5f Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// base 10 (SI prefixes)
	Bit Datasize = 1e0

	Byte     = Bit * 8
	Kilobyte = Byte * 1e3
	Megabyte = Byte * 1e6
	Gigabyte = Byte * 1e9
	Terabyte = Byte * 1e12
	Petabyte = Byte * 1e15
	Exabyte  = Byte * 1e18
)

...

Variables

This section is empty.

Functions

func ParseDatasize

func ParseDatasize(str string) (float32, error)

ParseDatasize parses datasize

Types

type Datasize

type Datasize float32

Datasize represents a unit of data size (in bits, bit)

func (Datasize) Bits

func (b Datasize) Bits() float64

Bits returns the datasize in bit

func (Datasize) Bytes

func (b Datasize) Bytes() float64

Bytes returns the datasize in B

func (Datasize) Exabytes

func (b Datasize) Exabytes() float64

Exabytes returns the datasize in EB

func (Datasize) Gigabytes

func (b Datasize) Gigabytes() float64

Gigabytes returns the datasize in GB

func (Datasize) Kilobytes

func (b Datasize) Kilobytes() float64

Kilobytes returns the datasize in kB

func (Datasize) MarshalText

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

MarshalText implements encoding.TextMarshaler

func (Datasize) Megabytes

func (b Datasize) Megabytes() float64

Megabytes returns the datasize in MB

func (Datasize) Petabytes

func (b Datasize) Petabytes() float64

Petabytes returns the datasize in PB

func (Datasize) String

func (b Datasize) String() string

func (Datasize) Terabytes

func (b Datasize) Terabytes() float64

Terabytes returns the datasize in TB

func (*Datasize) UnmarshalText

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

UnmarshalText unmashal data

Jump to

Keyboard shortcuts

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