Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstOrZero ¶
func FirstOrZero[T any](t []T) T
FirstOrZero returns the first value of a slice or the zero slice if slize is empty.
func PointerOrDefault ¶
func PointerOrDefault[T any](t T, defaultValue T) *T
PointerOrDefault returns the pointer of the given value. If the given value is equal to the zero value, the pointer of the default value will be returned instead.
func PointerOrNil ¶
func PointerOrNil[T any](t T) *T
PointerOrNil returns the pointer of the given value or nil if given value is equal to zero value.
func SafeDeref ¶
func SafeDeref[T any](t *T) T
SafeDeref returns the value from the passed pointer or zero value for a nil pointer.
func SafeDerefOrDefault ¶
func SafeDerefOrDefault[T any](t *T, defaultValue T) T
SafeDerefOrDefault returns the value from the passed pointer or the default value for a nil pointer or zero value.
func WrapInSlice ¶
func WrapInSlice[T any](t T) []T
FirstOrZero returns a slice that wraps the given value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.