Documentation
¶
Overview ¶
Package ptr provides utility functions for working with pointers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func From ¶
func From[T any](p *T) (zero T)
From dereferences a pointer by returning the zero value if null
func IsInterfaceNil ¶
IsInterfaceNil checks if either an interface or it's underlying concrete value is nil. If the type can't be nil, it return's false.
func Or ¶
func Or[T comparable](vals ...T) T
Or returns the first of its arguments that is not equal to the zero value. If no argument is non-zero, it returns the zero value. Essentially cmp.Or that rejects nil interfaces.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.