Documentation
¶
Index ¶
- func RunWithTimeout[T any](ctx context.Context, timeout time.Duration, f func(context.Context) (T, error)) (T, error)
- func SafeFunc0[U any](f func() U) func() (U, error)
- func SafeFunc0E[U any](f func() (U, error)) func() (U, error)
- func SafeFunc0V(f func()) func() error
- func SafeFunc0VE(f func() error) func() error
- func SafeFunc1[T1, U any](f func(T1) U) func(T1) (U, error)
- func SafeFunc1E[T1, U any](f func(T1) (U, error)) func(T1) (U, error)
- func SafeFunc1V[T1 any](f func(T1)) func(T1) error
- func SafeFunc1VE[T1 any](f func(T1) error) func(T1) error
- func SafeFunc2[T1, T2, U any](f func(T1, T2) U) func(T1, T2) (U, error)
- func SafeFunc2E[T1, T2, U any](f func(T1, T2) (U, error)) func(T1, T2) (U, error)
- func SafeFunc2V[T1, T2 any](f func(T1, T2)) func(T1, T2) error
- func SafeFunc2VE[T1, T2 any](f func(T1, T2) error) func(T1, T2) error
- func ToError(x interface{}) error
- type ErrorOf
- type Tuple2
- type Tuple3
- type Tuple4
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunWithTimeout ¶
func RunWithTimeout[T any]( ctx context.Context, timeout time.Duration, f func(context.Context) (T, error), ) (T, error)
RunWithTimeout executes function f with a context constructed from ctx with the addition of timeout.
func SafeFunc0 ¶
SafeFunc0 returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
func SafeFunc0E ¶
SafeFunc0E returns a function that never panics. That function returns the same values as f if f doesn't panic and returns an error if f panics.
func SafeFunc0V ¶
func SafeFunc0V(f func()) func() error
SafeFunc0V returns a function that never panics. That function returns nil if f doesn't panic and returns an error if f panics.
func SafeFunc0VE ¶
SafeFunc0VE returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
func SafeFunc1 ¶
SafeFunc1 returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
func SafeFunc1E ¶
SafeFunc1E returns a function that never panics. That function returns the same values as f if f doesn't panic and returns an error if f panics.
func SafeFunc1V ¶
SafeFunc1V returns a function that never panics. That function returns nil if f doesn't panic and returns an error if f panics.
func SafeFunc1VE ¶
SafeFunc1VE returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
func SafeFunc2 ¶
SafeFunc2 returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
func SafeFunc2E ¶
SafeFunc2E returns a function that never panics. That function returns the same values as f if f doesn't panic and returns an error if f panics.
func SafeFunc2V ¶
SafeFunc2V returns a function that never panics. That function returns nil if f doesn't panic and returns an error if f panics.
func SafeFunc2VE ¶
SafeFunc2VE returns a function that never panics. That function returns the same value as f if f doesn't panic and returns an error if f panics.
Types ¶
type ErrorOf ¶
type ErrorOf struct {
Value interface{}
}
ErrorOf is a type that wraps an arbitrary value to turn the value into an error instance
type Tuple3 ¶
type Tuple3[T1, T2, T3 any] struct { X1 T1 X2 T2 X3 T3 }
Tuple3 is tuple with 3 elements