utils

package
v0.0.0-...-f05cc18 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 4 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountBetweenTimes

func CountBetweenTimes(t1, t2 time.Time, interval time.Duration) int64

CountBetweenTimes will return the number of interval between two times rounded down to the given interval

func ElapsedTime

func ElapsedTime(callback func() error) (time.Duration, error)

func FromReferenceOrDefault

func FromReferenceOrDefault[T any](t *T) T

FromReferenceOrDefault return the value from the reference or the default value from the type is the reference is nil

func GoVersion

func GoVersion() string

GoVersion returns the go version used to compile the library

func MapToList

func MapToList[T1 comparable, T2 any](m map[T1]T2) []T2

MapToList will change a map to a list.

func Must

func Must[T any](a T, err error) T

func Round

func Round(num float64, precision int) float64

Round rounds a float64 number to a given precision

func RoundDownTime

func RoundDownTime(t time.Time, interval time.Duration) time.Time

func TemporaryEnvVar

func TemporaryEnvVar(key, value string) (reset func())

func ToReference

func ToReference[T any](t T) *T

ToReference return the value in argument as a reference

Types

This section is empty.

Jump to

Keyboard shortcuts

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