Documentation
¶
Index ¶
- Variables
- func A(b bool, msgS ...string)
- func Bind[T any](err error, fn func() (T, error)) (T, error)
- func Bind0(err error, fn func() error) error
- func Bind1[T any](err error, fn func() (T, error)) (T, error)
- func Bind2[T any, U any](err error, fn func() (T, U, error)) (T, U, error)
- func Catch(errRef *error, callbacks ...func(error))
- func Debugger()
- func E(rest ...any) error
- func Elvis[T comparable](t T, f T) T
- func ElvisF[T comparable](t func() T, f func() T) (ret T)
- func Err[T any](err error) (T, error)
- func Ignore[T any](T, ...any)
- func Let[T any](err error, fn func() T) T
- func Let0(err error, fn func())
- func Let1[T any](err error, fn func() T) T
- func Let2[T any, U any](err error, fn func() (T, U)) (T, U)
- func Nil[T any]() (t T)
- func Ok[T any](value T) (T, error)
- func P[T any](v T) *T
- func PMap[T any, U any](pt *T, fn func(*T) *U) *U
- func PR[T any](value T, err error) *result[*T]
- func Ptr[T any](v T) *T
- func PtrMap[T any, U any](pt *T, fn func(*T) *U) *U
- func R[T any](value T, err error) *result[T]
- func RecoverPanicObject[T comparable](errRef *error, target T, fn func() error)
- func RecoverPanicType[T any](errRef *error, fn func(T) error)
- func Ternary[T any](cond bool, t T, f T) T
- func TernaryF[T any](cond bool, t func() T, f func() T) (ret T)
- func TernaryF2[T any, U any](cond bool, t func() (T, U), f func() (T, U)) (ret1 T, ret2 U)
- func Then(err error, fn func() error) error
- func V[T any](value T, err error) T
- func V0[T any](first T, rest ...any)
- func V2[T any, U any](value1 T, value2 U, err error) (T, U)
- func V3[T any, U any, V any](value1 T, value2 U, value3 V, err error) (T, U, V)
Constants ¶
This section is empty.
Variables ¶
var Assert = A
var WaitForDebugger = Debugger
Functions ¶
func Bind ¶
Bind returns the result of the given function that can fail if err is nil, otherwise the error.
func Debugger ¶ added in v0.0.2024021544
func Debugger()
Debugger waits for a debugger to connect if the environment variable $WAIT or $DEBUG is set
func Elvis ¶ added in v0.0.2024072420
func Elvis[T comparable](t T, f T) T
Elvis returns the first value if it is not empty, otherwise the second value. // Elvis operator - Wikipedia https://en.wikipedia.org/wiki/Elvis_operator
func ElvisF ¶ added in v0.0.2024072421
func ElvisF[T comparable]( t func() T, f func() T, ) (ret T)
ElvisF returns the result of the first function if it is not empty, otherwise the result of the second function.
func Let0 ¶
func Let0(err error, fn func())
Let0 calls the given function if err is nil and returns nothing.
func RecoverPanicObject ¶
func RecoverPanicObject[T comparable](errRef *error, target T, fn func() error)
func RecoverPanicType ¶
func Ternary ¶
Ternary returns the first value if cond is true, otherwise the second value. // Ternary conditional operator - Wikipedia https://en.wikipedia.org/wiki/Ternary_conditional_operator
func TernaryF ¶
TernaryF returns the result of the first function if cond is true, otherwise the result of the second function.
func TernaryF2 ¶ added in v0.0.2024072004
TernaryF2 returns the result of the first function if cond is true, otherwise the result of the second function.
Types ¶
This section is empty.