Documentation
¶
Overview ¶
Package common global shared utils
Index ¶
- func AbsInt32(v int32) int32
- func AbsInt64(v int64) int64
- func Bytes2Str(b []byte) string
- func HumanReadableByteCount(bytes int64, si bool) (ret string)
- func Max[T Sortable](vals ...T) T
- func Min[T Sortable](vals ...T) T
- func Number2Roman(n int) (roman string)
- func Round(val float64, d int) float64
- func Str2Bytes(s string) []byte
- type Number
- type SortOrder
- type Sortable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsInt32 ¶ added in v4.7.1
AbsInt32 abs(v)
ignore int exceeds limit error, abs(MinInt32) == MaxInt32
func AbsInt64 ¶ added in v4.7.1
AbsInt64 abs(v)
ignore int exceeds limit error, abs(MinInt64) == MaxInt64
func HumanReadableByteCount ¶ added in v4.7.1
HumanReadableByteCount convert bytes to human readable string
Args:
- bytes:
- si: `si ? 1024 : 1000`
Example:
`HumanReadableByteCount(1005, false) -> "1.01KB"`
func Number2Roman ¶ added in v4.7.3
Number2Roman convert number to roman
Types ¶
type Number ¶ added in v4.7.1
type Number interface { int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64 }
Number is a number type
Click to show internal directories.
Click to hide internal directories.