ptr

package
v1.9.0-p01 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref[T any](t *T) T

Deref returns the value referenced by t if not nil, otherwise the empty value for T is returned.

func DerefWithDefault

func DerefWithDefault[T any](t *T, defaulT T) T

DerefWithDefault returns the value referenced by t if not nil, otherwise defaulT is returned.

func Equal

func Equal[T comparable](a, b *T) bool

Equal returns true if both arguments are nil or both arguments dereference to the same value.

func Overwrite

func Overwrite[T any](dst *T, src T)

Overwrite copies src to dst if: - src is a non-nil channel, function, interface, map, pointer, or slice - src is any other type of value Please note, this function panics if dst is nil.

func OverwriteWithUser

func OverwriteWithUser[T comparable](dst **T, user, current *T)

OverwriteWithUser overwrites the *dst with an optional user value depending on if the value needs to be updated based on the current value.

func To

func To[T any](t T) *T

To returns a pointer to t.

Types

This section is empty.

Jump to

Keyboard shortcuts

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