ptrutil

package
v1.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL