util

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeadlineExceeded = errors.New("deadline exceeded")

Functions

func ByteSize

func ByteSize(size int) string

func Copy

func Copy[T any](src T) *T

func Deadline

func Deadline(ctx context.Context, fn func(exceeded <-chan struct{}) error) error

func Equals

func Equals(first any, second any) bool

func ExponentialRetry

func ExponentialRetry(attempts int, initialDelay time.Duration, limitDelay time.Duration,
	retriables []error, fn func(attempt int) error) error

func GetEnv

func GetEnv[T string | int | bool | []string | []int | []bool](key string, def T) T

func Merge

func Merge[T any](dst *T, src T)

func Optional

func Optional[T any](param []T, def T) T

func Pointer

func Pointer[T any](variable T) *T

func RandomString

func RandomString(length int) string

func Retry

func Retry(attempts int, delay time.Duration, retriables []error, fn func(attempt int) error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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