Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSize ¶
type ByteSize uint64
ByteSize represents a number of bytes. It can be unmarshalled from a JSON number or a JSON string such as "10k" or "16mb" or "32 PB".
func FromString ¶
FromString converts a string like "10 mb" or "16k" to a ByteSize. See units.RAMInBytes for more details.
func (ByteSize) MarshalJSON ¶
MarshalJSON encodes the ByteSize as a JSON string.
func (*ByteSize) UnmarshalJSON ¶
UnmarshalJSON converts a JSON number or string to a ByteSize. If b is a JSON number, it must be a positive integer. If b is a JSON string, it must be parsable by units.RAMInBytes.
type NegativeSizeError ¶
type NegativeSizeError struct {
Size int64
}
NegativeSizeError is returned when parsing a negative size.
func (NegativeSizeError) Error ¶
func (e NegativeSizeError) Error() string
Click to show internal directories.
Click to hide internal directories.