Documentation
¶
Overview ¶
Package pointer provides reflection-based helpers for working with pointers. These functions are useful for dynamically allocating and dereferencing variables in contexts like configuration loading or data mapping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alloc ¶
Alloc allocates a new value for a nil pointer and sets the pointer to it.
This function causes a panic if rv is not a settable pointer.
func Deref ¶
Deref follows pointers until it reaches a non-pointer, allocating if nil.
If a nil pointer is encountered along the way, Deref will attempt to allocate a new value for it. If it encounters an un-settable nil pointer (e.g., one within an unexported struct field), it stops and returns that pointer to prevent a panic. The final, non-pointer value is returned.
Types ¶
This section is empty.