humanize

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package humanize transforms values into more user friendly representations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(duration time.Duration) string

Duration returns a humanized duration, e.g. 22d 10h 5m.

func Error

func Error(err error) string

Error returns a user friendly error message for an error.

func Number

func Number(value float64, decimals int) string

Number returns a humanized number, e.g. 1234 becomes 1.23K

func Optional

func Optional[T time.Duration | time.Time | string | int | int32 | int64](o optional.Optional[T], fallback string) string

func OptionalFloat

func OptionalFloat[T float32 | float64](o optional.Optional[T], decimals int, fallback string) string

func RomanLetter

func RomanLetter[T constraints.Integer](v T) string

RomanLetter returns a number as roman letters.

func Time

func Time(v time.Time, fallback string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL