Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func To ¶
func To[T any](value T) *T
To returns the address of any given value. This is useful because in Go it is illegal to take the address of a literal value (i.e. is not possible to do &"string") - this helper function allows us to do pointer.To("string") in-line.
func ValueOrDefault ¶
func ValueOrDefault[T any](ptr *T, defaultValue T) T
ValueOrDefault returns the value of dereferencing a pointer if the pointer is not nil, or a given default value if nil.
func ValueOrZero ¶
func ValueOrZero[T any](ptr *T) T
ValueOrZero returns the value of dereferencing a pointer if the pointer is not nil, or the zero value of the type if nil.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.