ptr

package
v0.0.45-4be4963 Latest Latest
Warning

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

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

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

func IsInterfaceNil(i any) bool

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.

func To

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

To returns a pointer to value

Types

This section is empty.

Jump to

Keyboard shortcuts

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