reflectutil

package
v1.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Elem

func Elem[T canElem[T]](v T) T

Elem unwraps the underlying elem of the pointer.

Nested pointers are also supported - e.g. given "****value" it will return "value".

Non-pointer values will be returned as is.

func Fill

func Fill(v reflect.Value) bool

func Filled

func Filled(hint reflect.Type) (reflect.Value, bool)

Filled returns a new value T with all the exported pointer fields recursively set to non-nil zero values. That is, if type is a struct and contains field *int it will be set to &0. That logic is also applies for nested structs.

func FindRecursiveType

func FindRecursiveType(t reflect.Type) reflect.Type

func NameOf

func NameOf[T any]() string

NameOf returns name of the underlying type T.

func New

func New[T any]() T

New a new zero value of T.

As a special case for pointers it will return pointer to the zero value of T (not nil).

Types

This section is empty.

Jump to

Keyboard shortcuts

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