Documentation ¶
Index ¶
- func Cast[E any](v any) (E, error)
- func Const[E, F any](e E) func(F) E
- func Deref[E any](e *E, defaultValue E) E
- func DerefFunc[E any](e *E, defaultFunc func() E) E
- func DerefZero[E any](e *E) E
- func Identity[E any](e E) E
- func PipeMap[E any](e E, fs ...func(E) E) E
- func Pointer[E any](e E) *E
- func ReflectType[E any]() reflect.Type
- func TODO[V any](args ...any) V
- func Zero[E any]() E
- func ZeroPointer[E any]() *E
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Const ¶
func Const[E, F any](e E) func(F) E
Const produces a function that takes an argument and returns the original argument, ignoring the passed-in value.
func Deref ¶
func Deref[E any](e *E, defaultValue E) E
Deref returns the value e points to if it's non-nil. Otherwise, it returns the defaultValue.
func DerefFunc ¶
func DerefFunc[E any](e *E, defaultFunc func() E) E
DerefFunc returns the value e points to if it's non-nil. Otherwise, it returns the result of calling defaultFunc.
func DerefZero ¶
func DerefZero[E any](e *E) E
DerefZero returns the value e points to if it's non-nil. Otherwise, it returns the zero value for type E.
func Identity ¶
func Identity[E any](e E) E
Identity is a function that returns its given parameters.
func ReflectType ¶
func TODO ¶
TODO is a function to create holes when stubbing out more complex mechanisms.
By default, it will panic with 'TODO: provide a value of type <type>' where <type> is the type of V. The panic message can be altered by passing in additional args that will be printed as 'TODO: <args separated by space>'
func ZeroPointer ¶
func ZeroPointer[E any]() *E
ZeroPointer returns a pointer to a zero value of type E.
Types ¶
This section is empty.