util

package
v0.0.0-...-84c28f3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YYMMDD = "2006/01/02 15:04:05"
)

Define constant YYMMDD as the date format used in the function

Variables

This section is empty.

Functions

func InterfaceToFloat64

func InterfaceToFloat64(val interface{}) float64

InterfaceToFloat64 will convert any interface value to float64

func Retry

func Retry(ctx context.Context, n int, interval time.Duration,
	done chan<- bool, f RetryFunc, onSucceed RetryCallbackFunc, onError RetryCallbackFunc)

Retry is a wrapper function that is used to try to call external resources that have the potential to fail

func TimeDifference

func TimeDifference(timeFrom string, timeNow string) string

TimeDifference calculates the difference in minutes between two timestamps timeFrom and timeNow, passed as strings in the format defined in YYMMDD The function returns a string with the difference in minutes

Types

type RetryCallbackFunc

type RetryCallbackFunc func()

RetryCallbackFunc is a function type for callback

type RetryFunc

type RetryFunc func() bool

RetryFunc is a function type that will try to be called again if it doesn't work

Jump to

Keyboard shortcuts

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