util

package
v0.0.0-...-d2b7790 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinDuration = 10 * time.Second
	MaxDuration = 30 * time.Second
)

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

func GenRandInt

func GenRandInt(min, max int) int

func GetAvailablePort

func GetAvailablePort() (int, error)

func GetLocalIP

func GetLocalIP() (string, error)

func GetLocalIP2

func GetLocalIP2() (string, error)

func IsPortAvailable

func IsPortAvailable(port int) bool

func Max

func Max[T int | uint | int64 | uint64 | float64](data []T) T

func Min

func Min[T int | uint | int64 | uint64 | float64](data []T) T

func ParseDurationWithInt32

func ParseDurationWithInt32(val int32, defaultDuration time.Duration) time.Duration

func ParseDurationWithString

func ParseDurationWithString(text string, defaultDuration time.Duration) time.Duration

func Sum

func Sum[T int | uint | int64 | uint64 | float64](data []T) T

func Trunc2

func Trunc2(val float64) float64

Trunc2 trunc2

func Trunc4

func Trunc4(val float64) float64

func TruncN

func TruncN(f float64, n int) float64

func YearWeek

func YearWeek(t time.Time) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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