Documentation
¶
Overview ¶
Package jt defines the Size type to handle size parameters in JSON structures in a more user-friendly way.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Size ¶
type Size int
Size is a specific type for handling data size parameters. It shortens the string representation. For instance 8 MiB are represented as "8M", 16 KiB as "16K", 2 GiB as "2G". It is also possible to use plain numbers for it.
func (Size) MarshalJSON ¶
MarshalJSON returns the string representation of the size as byte slice. It is used by the JSON encoder.
func (Size) String ¶
String returns the string representation of the size. It uses K, M, and G as suffixes for KiB, MiB, and GiB, respectively.
func (*Size) UnmarshalJSON ¶
UnmarshalText parses the string representation of the size and sets the value of s. It is used by the JSON decoder.