dreflect

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(val reflect.Value, typ reflect.Type) reflect.Value

Convert converts the input reflect.Value `val` to the specified reflect.Type `typ` and returns the result. Convert extends the functionality of the reflect.Convert function by also convert subtypes.

func ConvertToType

func ConvertToType[T any](val any) T

ConvertToType converts the input value `val` to the specified type `T` and returns it.

func GetPointerOfValueType

func GetPointerOfValueType(val any) any

GetPointerOfValueType returns a pointer to a new value of the same type as the input value `val`. The new value is initialized to the input value.

func GetSliceType

func GetSliceType(slice any) reflect.Type

GetSliceType returns the element type of the input slice `slice`.

func GetTypeHash

func GetTypeHash(v interface{}) string

GetTypeHash recursively generates a hash based on struct type

func GetUnderlyingPointerValue

func GetUnderlyingPointerValue(ptr any) any

GetUnderlyingPointerValue dereferences the input pointer `ptr` and returns the value it points to.

Types

This section is empty.

Jump to

Keyboard shortcuts

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