go.bigb.es/auxilia
Documentation
Index
- func Curry1(f func(V1), v1 V1) func()
- func FirstOf2(a V1, _ V2) V1
- func FirstOf3(a V1, _ V2, _ V3) V1
- func GetType() reflect.Type
- func IsZero(inp T) bool
- func Must(err error)
- func Must1(v1 V1, err error) V1
- func Must2(v1 V1, v2 V2, err error) (V1, V2)
- func Must3(v1 V1, v2 V2, v3 V3, err error) (V1, V2, V3)
- func SecondOf2(_ V1, a V2) V2
- func SecondOf3(_ V1, a V2, _ V3) V2
- func ThirdOf3(_ V1, _ V2, a V3) V3
- func Zero() T
Functions
func Curry1[V1 any](f func(V1), v1 V1) func()
Curry1 partially applies f with v1, returning a zero-argument closure.
func FirstOf2[V1 any, V2 any](a V1, _ V2) V1
FirstOf2 returns the first of two arguments, discarding the second. It is useful for inlining multi-return calls when only the first value is needed.
func FirstOf3[V1 any, V2 any, V3 any](a V1, _ V2, _ V3) V1
FirstOf3 returns the first of three arguments, discarding the rest.
func GetType[T any]() reflect.Type
GetType returns the reflect.Type of type T without requiring an instance.
func IsZero[T comparable](inp T) bool
IsZero reports whether inp equals the zero value of its type.
func Must(err error)
Must panics if err is non-nil. It is intended for wrapping calls that return only an error in contexts where failure is unexpected.
func Must1[V1 any](v1 V1, err error) V1
Must1 returns v1 or panics if err is non-nil. It is intended for wrapping calls of the form func() (T, error).
func Must2[V1 any, V2 any](v1 V1, v2 V2, err error) (V1, V2)
Must2 returns (v1, v2) or panics if err is non-nil. It is intended for wrapping calls of the form func() (T1, T2, error).
func Must3[V1 any, V2 any, V3 any](v1 V1, v2 V2, v3 V3, err error) (V1, V2, V3)
Must3 returns (v1, v2, v3) or panics if err is non-nil. It is intended for wrapping calls of the form func() (T1, T2, T3, error).
func SecondOf2[V1 any, V2 any](_ V1, a V2) V2
SecondOf2 returns the second of two arguments, discarding the first.
func SecondOf3[V1 any, V2 any, V3 any](_ V1, a V2, _ V3) V2
SecondOf3 returns the second of three arguments, discarding the rest.
func ThirdOf3[V1 any, V2 any, V3 any](_ V1, _ V2, a V3) V3
ThirdOf3 returns the third of three arguments, discarding the rest.
Package fn provides generic utility functions for zero values, tuple selectors, must-helpers, and partial application.