ptr

package
v2.29.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 1 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ptr contains some utility methods related to pointers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NilOrEmpty

func NilOrEmpty(s *string) bool

NilOrEmpty returns true if s is nil or the empty string.

func NilOrZero

func NilOrZero[T number](v *T) bool

NilOrZero returns true if v is nil or 0.

func NilToDefault

func NilToDefault[T any](s *T, def T) T

NilToDefault coalesces a nil value to the provided default value.

func NilToEmpty

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

NilToEmpty coalesces a nil value to the empty value.

func Ref

func Ref[T any](v T) *T

Ref returns a reference to v.

Types

This section is empty.

Jump to

Keyboard shortcuts

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