Documentation
¶
Index ¶
- Variables
- func Assert(b bool, messages ...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)
- func Contains[T comparable](items []T, target T) bool
- func Debugger()
- func Ensure[T any](value T, err error) T
- func Ensure0[T any](first T, rest ...any)
- func Ensure1[T any](value T, err error) T
- func Ensure2[T any, U any](value T, value2 U, err error) (T, U)
- 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 Map[T any, U any](items []T, fn func(T) U) []U
- func NewPtrResult[T any](ptr *T, err error) *ptrResult[T]
- func NewResult[T any](ptr *T, err error) *ptrResult[T]
- func NewValueResult[T any](value T, err error) *ptrResult[T]
- func Ok[T any](value T) (T, error)
- 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) T
- func R0[T any](first T, rest ...any)
- func R1[T any](value T, err error) T
- func R2[T any, U any](value T, value2 U, err error) (T, U)
- 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) T
- func Then(err error, fn func() error) error
Constants ¶
This section is empty.
Variables ¶
View Source
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 Contains ¶
func Contains[T comparable](items []T, target T) bool
Contains checks if “target” is in “items”.
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 Let0 ¶
func Let0(err error, fn func())
Let0 calls the given function if err is nil and returns nothing.
func NewPtrResult ¶
NewPtrResult returns a pointer + error context to ignore specific errors.
func NewValueResult ¶
NewValueResult returns a value + error context to ignore specific errors.
func RecoverPanicObject ¶
func RecoverPanicObject[T comparable](errRef *error, target T, fn func() error)
func RecoverPanicType ¶
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.