ptr

package
v1.1.42 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnforcePtr

func EnforcePtr(obj any) (reflect.Value, error)

EnforcePtr takes an interface `obj` and returns the dereferenced value if `obj` is a non-nil pointer. It returns an error if `obj` is not a pointer, is nil, or is an invalid type.

func GenerateElementBySlice

func GenerateElementBySlice(slice any) (any, error)

GenerateElementBySlice takes a slice or a pointer to a slice as input and returns a new zero-valued element of the slice's element type. It returns an error if the input is not a slice or a pointer to a slice.

func GenerateElementPtrBySlice

func GenerateElementPtrBySlice(slice any) (any, error)

GenerateElementPtrBySlice takes a slice or a pointer to a slice as input and returns a pointer to a new zero-valued element of the slice's element type. It returns an error if the input is not a slice or a pointer to a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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