Documentation
¶
Index ¶
- func Getenv(key, fallback string) string
- func Loop(function func(), interval time.Duration) func()
- func LoopWithParam[T any](function func(T), param T, interval time.Duration) func()
- func Ptr[T any](v T) *T
- func RunOnce(function func(), id any)
- func RunOnceWithParam[T any](function func(T), param T, id any)
- func StoppableLoop(function func() bool, interval time.Duration) func()
- func StoppableLoopWithParam[T any](function func(T) bool, param T, interval time.Duration) func()
- func StructToMap(data any) map[string]interface{}
- func UnmarshalFile[T any](path string) (T, error)
- func WaitFor(functions ...func())
- func WaitForWithOs(functions ...func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Getenv ¶
Getenv reads the value from environment variable named by key. If the key is not defined as environment variable the default string is returned.
func Loop ¶
Loop wraps a function in an endless loop and calls the function in the defined interval.
func LoopWithParam ¶ added in v1.0.16
func RunOnce ¶
func RunOnce(function func(), id any)
RunOnce starts a function if this function not currently running. RunOnce knows, with function is currently running (identified by id) and skips starting the function again.
func RunOnceWithParam ¶ added in v1.0.18
RunOnceWithParam starts a function if this function not currently running. RunOnce knows, with function is currently running (identified by id) and skips starting the function again.
func StoppableLoop ¶ added in v1.0.16
StoppableLoop wraps a function in a loop and calls the function in the defined interval until the function return false.
func StoppableLoopWithParam ¶ added in v1.0.16
func StructToMap ¶
StructToMap converts a struct to map of struct properties
func UnmarshalFile ¶
UnmarshalFile returns the content of the file as object of type T
func WaitFor ¶
func WaitFor(functions ...func())
WaitFor helps to start multiple functions in parallel and waits until all functions are completed.
func WaitForWithOs ¶ added in v1.0.11
func WaitForWithOs(functions ...func())
WaitForWithOs helps to start multiple functions in parallel and waits until all functions are completed or if system signals termination
Types ¶
This section is empty.