ptr

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 0 Imported by: 0 modules, 0 packages

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 provides helpers for the pointer fields used throughout the entity model. Nullable database columns are modelled as pointers so that "absent" stays distinguishable from the zero value — a distinction the Java entities got for free from boxed types (Integer, Long, Boolean) and nullable Strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From

func From[T any](p *T) T

From dereferences p, returning the zero value of T when p is nil.

func FromOr

func FromOr[T any](p *T, def T) T

FromOr dereferences p, returning def when p is nil.

func NonBlank

func NonBlank(s *string) *string

NonBlank returns nil when s points at an empty string, and s otherwise. The Java services normalise blank form fields to null before mapping so that an empty field means "leave unchanged" rather than "erase the stored value"; this is that rule.

func To

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

To returns a pointer to v. Useful for literals: ptr.To(42), ptr.To("gpu").

Types

This section is empty.

Jump to

Keyboard shortcuts

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