bytesize

package
v0.0.0-...-e035375 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB
	PB
)

Variables

View Source
var (
	ErrBadByteSize     = errors.New("invalid bytesize")
	ErrBadByteSizeUnit = errors.New("invalid bytesize unit")
)

Functions

func MustParse

func MustParse(s string) uint64

func Parse

func Parse(s string) (uint64, error)

Types

type ByteSize

type ByteSize uint64

func (ByteSize) AsInt

func (b ByteSize) AsInt() int

func (ByteSize) HumanString

func (b ByteSize) HumanString() string

func (ByteSize) MarshalText

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

func (ByteSize) UInt64

func (b ByteSize) UInt64() uint64

func (*ByteSize) UnmarshalText

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

type Flag

type Flag struct {
	// contains filtered or unexported fields
}

func (*Flag) Default

func (f *Flag) Default(size ByteSize)

func (*Flag) Set

func (f *Flag) Set(value string) error

func (*Flag) Size

func (f *Flag) Size() ByteSize

func (*Flag) String

func (f *Flag) String() string

Jump to

Keyboard shortcuts

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