Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyIfSet ¶
func ApplyIfSet[T any](dst *T, src *T)
ApplyIfSet sets *dst to *src if src is non-nil. Use this to merge optional (pointer) fields from a PATCH input into an existing plain-value struct without overwriting fields that were not provided in the request.
func Deref ¶
func Deref[T any](ptr *T) T
Deref returns the value of the given pointer as long as it's non-nil, and the zero value of T otherwise.
func ValOrDefault ¶
func ValOrDefault[T any](ptr *T, defaultVal T) T
ValOrDefault returns the value of the given pointer as long as it's non-nil, and the specified default value otherwise.
func ValOrDefaultFunc ¶
func ValOrDefaultFunc[T any](ptr *T, defaultFunc func() T) T
ValOrDefaultFunc returns the value of the given pointer as long as it's non-nil, or invokes the given function to produce a default value otherwise.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.