Documentation
¶
Index ¶
Constants ¶
Binary/IEC byte size constants based on powers of 1024.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bytes ¶
type Bytes uint64
Bytes represents a data size in bytes as an unsigned 64-bit integer.
func (Bytes) String ¶
String implements the fmt.Stringer interface. It formats the Bytes value back into a human-readable string rounded to two decimal places (e.g., "1.50MB", "450B").
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. It parses a JSON string containing human-readable data sizes (e.g., "10mb", "500K", "1.5GB") into a Bytes integer value.
type TimeDuration ¶
TimeDuration extends standard time.Duration to add custom JSON serialization and support for day-based representations (e.g., "7d").
func (TimeDuration) MarshalJSON ¶
func (o TimeDuration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface. It serializes the TimeDuration into its string representation.
func (TimeDuration) String ¶
func (o TimeDuration) String() string
String returns a string representation of the duration. If the duration is an exact multiple of 24 hours, it formats it using the "d" suffix (e.g., "2d"). Otherwise, it falls back to time.Duration.String().
func (*TimeDuration) UnmarshalJSON ¶
func (o *TimeDuration) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. It parses a JSON string into a TimeDuration, extending time.ParseDuration to natively support the "d" suffix for days (1d = 24h).