Documentation ¶
Index ¶
- Variables
- type Size
- func (sz Size) AppendFormat(dst []byte) []byte
- func (sz Size) AppendFormatIEC(dst []byte) []byte
- func (sz Size) AppendFormatSI(dst []byte) []byte
- func (sz *Size) MarshalText() ([]byte, error)
- func (sz *Size) Set(in string) error
- func (sz Size) String() string
- func (sz Size) StringIEC() string
- func (sz Size) StringSI() string
- func (sz *Size) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidUnit is returned when an invalid IEC/SI is provided. ErrInvalidUnit = errors.New("bytesize: invalid unit") // ErrInvalidFormat is returned when an invalid size value is provided. ErrInvalidFormat = errors.New("bytesize: invalid format") )
Functions ¶
This section is empty.
Types ¶
type Size ¶
type Size uint64
Size is a casting for uint64 types that provides formatting methods for byte sizes in both IEC and SI units.
func ParseSize ¶
ParseSize will parse a valid Size from given string. Both IEC and SI units are supported.
func (Size) AppendFormat ¶
AppendFormat defaults to using Size.AppendFormatIEC().
func (Size) AppendFormatIEC ¶
AppendFormatIEC will append IEC formatted size to 'dst'.
func (Size) AppendFormatSI ¶
AppendFormatSI will append SI formatted size to 'dst'.
func (*Size) MarshalText ¶ added in v1.0.0
MarshalText implements encoding.TextMarshaler{}.
func (*Size) UnmarshalText ¶ added in v1.0.0
UnmarshalText implements encoding.TextUnmarshaler{}.
Click to show internal directories.
Click to hide internal directories.