pointer

package
v0.31.0 Latest Latest
Warning

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

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

README

pointer

A single helper, pointer.To(value any) any, that returns a pointer to its argument (and returns the value unchanged if it is already a pointer or interface). Part of rosetta.

What matters here

  • To is reflection-based and untyped (any in, any out). It exists for cases where the type isn't known at compile time (e.g. building values dynamically for the schema engine). When the type is known, prefer the generic convert.Pointer[T](v) *T, which is type-safe and avoids reflection — convert owns the generic pointer/dereference helpers (Pointer, Element), not this package.
  • Already-pointer and interface inputs pass through unchanged, so To is idempotent — calling it on a *T returns the same *T, not a **T.

Documentation

Overview

Package pointer provides utility functions for creating pointers in Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func To

func To(value any) any

To returns the provided value as a pointer to the original. If the provided value is already a pointer, it is returned as-is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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