Documentation ¶
Index ¶
- func ConvertArr[Tin any, Tout any](in []Tin, convertFunc CovertFunc[Tin, Tout]) (convertedItems []Tout, err error)
- func DefaultIfEqual[T comparable](in T, checkEqualTo T, defaultVal T) T
- func ExecTask(ctx context.Context, tasks Task) error
- func ExecTasks(ctx context.Context, taskTimeout time.Duration, tasks []Task) error
- func Must(err error)
- func MustStr2Float[T Float](str string, bitSize int) T
- func MustStr2Int[T Int](str string, base int, bitSize int) T
- func Retry(ctx context.Context, retryTimes int, waitBeforeRetry time.Duration, exec Task) (success bool, errs []error)
- func Str2Bool(str string) (val bool, ok bool)
- func Str2Float[T Float](str string, bitSize int) (T, error)
- func Str2Int[T Int](str string, base int, bitSize int) (T, error)
- func Ternar[T any](condition bool, ifTrue T, ifFalse T) T
- func UnnilArray[T any](in []T) []T
- func UnnilMap[K comparable, V any](in map[K]V) map[K]V
- func ValOrDefaultNum[T Num](in T, defaultVal T) T
- func ValOrDefaultStr(in string, defaultVal string) string
- type CovertFunc
- type Float
- type IRange
- type IStrConvertable
- type Int
- type Num
- type Range
- type Signed
- type Task
- type Unsigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertArr ¶
func ConvertArr[Tin any, Tout any](in []Tin, convertFunc CovertFunc[Tin, Tout]) (convertedItems []Tout, err error)
Converts all the types in
func DefaultIfEqual ¶
func DefaultIfEqual[T comparable](in T, checkEqualTo T, defaultVal T) T
func ExecTasks ¶
ExecTasks Runs each task in a separate goroutine To set no task timeout -- set taskTimeout to 0
func MustStr2Float ¶
func UnnilArray ¶
func UnnilArray[T any](in []T) []T
If array is equal to nil -- will return an empty array instead
func UnnilMap ¶
func UnnilMap[K comparable, V any](in map[K]V) map[K]V
If map is equal to nil -- will return an empty map instead
func ValOrDefaultNum ¶
func ValOrDefaultNum[T Num](in T, defaultVal T) T
If in is 0 returns the devaultVal. Else returns in
func ValOrDefaultStr ¶
If in is empty returns the devaultVal. Else returns in
Types ¶
type CovertFunc ¶
type IStrConvertable ¶
type IStrConvertable interface {
String() string
}
Click to show internal directories.
Click to hide internal directories.