Documentation
¶
Index ¶
- func Contains[T comparable](s []T, e T) bool
- func EncodeURLParams(q any) string
- func Filter[T any](ss []T, test func(T, int) bool) (res []T)
- func Find[T any](ss []T, test func(T, int) bool) (res T)
- func FirstValue(values ...string) string
- func Foreach[T any](ss []T, apply func(T, int) T) []T
- func Hash(s string, l int) string
- func If[T any](condition bool, trueValue, falseValue T) T
- func IntOrDefault(value, defaultValue int) int
- func Map[T, V any](ts []T, fn func(T) V) []V
- func ParseInt(s string) int
- func ParseJson[T interface{}](jsonStr string) (T, error)
- func ParseTimeout(s string) time.Duration
- func RandomInt(min, max int) int
- func RandomString(length int) string
- func RegexSubMatch(r *regexp.Regexp, str string) map[string]string
- func Retry[T any](ctx context.Context, retries int, delay time.Duration, ...) (T, error)
- func Sleep(ctx context.Context, delay time.Duration)
- func SleepRandom(ctx context.Context, min, max int)
- func StartsWith(s, prefix string) bool
- func StringOrDefault(value, defaultValue string) string
- func StringToIntOrDefault(value string, defaultValue int) int
- func StripWhitespace(s string) string
- func Try(f func(), logger ...log.LoggerInterface)
- func TryCatch(f func(), catch func(e error, stackTrace string))
- func TryReturn[T any](f func() (T, error)) (res T, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](s []T, e T) bool
func EncodeURLParams ¶
func FirstValue ¶
func IntOrDefault ¶
func ParseTimeout ¶ added in v1.0.3
func RandomString ¶
func SleepRandom ¶
func StartsWith ¶
func StringOrDefault ¶
func StringToIntOrDefault ¶
func StripWhitespace ¶
func Try ¶
func Try(f func(), logger ...log.LoggerInterface)
Try wraps a goroutine and will recover from a panic If a logger is provided, it will log the error using the given logger
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.