Documentation
¶
Index ¶
- type Duration
- func (d Duration) Add(other Duration) Duration
- func (d Duration) Div(factor float64) Duration
- func (d Duration) Duration() time.Duration
- func (d Duration) Hours() float64
- func (d Duration) IsZero() bool
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) MarshalText() ([]byte, error)
- func (d Duration) MarshalYAML() (interface{}, error)
- func (d Duration) Microseconds() int64
- func (d Duration) Milliseconds() int64
- func (d Duration) Minutes() float64
- func (d Duration) Mul(factor float64) Duration
- func (d Duration) Nanoseconds() int64
- func (d Duration) PostgreSQLString() string
- func (d Duration) Round(precision time.Duration) Duration
- func (d Duration) Seconds() float64
- func (d Duration) String() string
- func (d Duration) Sub(other Duration) Duration
- func (d Duration) Truncate(precision time.Duration) Duration
- func (d *Duration) UnmarshalJSON(data []byte) error
- func (d *Duration) UnmarshalText(text []byte) error
- func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Size
- func (s Size) Add(other Size) Size
- func (s Size) Bytes() uint64
- func (s Size) Div(factor float64) Size
- func (s Size) Format(f fmt.State, verb rune)
- func (s Size) GB() uint64
- func (s Size) IsZero() bool
- func (s Size) KB() uint64
- func (s Size) MB() uint64
- func (s Size) MarshalJSON() ([]byte, error)
- func (s Size) MarshalText() ([]byte, error)
- func (s Size) MarshalYAML() (interface{}, error)
- func (s Size) Mul(factor float64) Size
- func (s Size) PostgreSQLMB() string
- func (s Size) PostgreSQLString() string
- func (s Size) String() string
- func (s Size) Sub(other Size) Size
- func (s *Size) UnmarshalJSON(data []byte) error
- func (s *Size) UnmarshalText(text []byte) error
- func (s *Size) UnmarshalYAML(unmarshal func(interface{}) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration represents a time duration that can be parsed from various string formats and provides type-safe operations. It stores the duration internally as time.Duration.
func MustParseDuration ¶
MustParseDuration parses a duration string and panics on error
func NewDuration ¶
NewDuration creates a Duration from a string, intended for known-valid values
func ParseDuration ¶
ParseDuration creates a Duration from a string representation (e.g., "5min", "30s", "1h")
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (Duration) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface (for koanf)
func (Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler interface
func (Duration) Microseconds ¶
Microseconds returns the duration as microseconds
func (Duration) Milliseconds ¶
Milliseconds returns the duration as milliseconds
func (Duration) Nanoseconds ¶
Nanoseconds returns the duration as nanoseconds
func (Duration) PostgreSQLString ¶
PostgreSQLString returns a PostgreSQL-compatible string representation
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
func (*Duration) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface (for koanf)
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler interface
type Size ¶
type Size uint64
Size represents a memory or storage size that can be parsed from various string formats and provides type-safe operations. It stores the size internally as bytes.
func MustParseSize ¶
MustParseSize parses a size string and panics on error
func ParseSize ¶
ParseSize creates a Size from a string representation (e.g., "128MB", "1GB", "512kB")
func (Size) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (Size) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface (for koanf)
func (Size) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler interface
func (Size) PostgreSQLMB ¶
PostgreSQLMB returns a PostgreSQL-compatible string representation in MB units
func (Size) PostgreSQLString ¶
PostgreSQLString returns a PostgreSQL-compatible string representation
func (*Size) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
func (*Size) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface (for koanf)
func (*Size) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler interface