reflect

package
v0.5.34 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFloatListReflectValue

func SetFloatListReflectValue[To cast.FloatNumber](value reflect.Value, v interface{}) error

func SetIntListReflectValue

func SetIntListReflectValue[To cast.Number](value reflect.Value, v interface{}) error

func SetReflectValue

func SetReflectValue(dst reflect.Value, src interface{}) error

func SetStringMapListReflectValue added in v0.5.9

func SetStringMapListReflectValue[To interface{}](mapSlice reflect.Value, v interface{}) error

func StripInterface added in v0.5.33

func StripInterface(v reflect.Value) reflect.Type

StripInterface takes a reflect.Value and returns the underlying type by recursively stripping off interface{} types while preserving pointer types.

For example: - string -> string - interface{}(string) -> string - *string -> *string - interface{}(*string) -> *string - *interface{}(string) -> *string - interface{}(*interface{}(string)) -> *string

If the value is invalid or nil, returns nil.

func StripInterfaceFromValue added in v0.5.33

func StripInterfaceFromValue(v reflect.Value) reflect.Value

StripInterfaceFromValue takes a reflect.Value and returns the underlying value by recursively stripping off interface{} types while preserving pointer types.

For example: - string -> string value - interface{}(string) -> string value - *string -> *string value - interface{}(*string) -> *string value - *interface{}(string) -> *string value - interface{}(*interface{}(string)) -> *string value

If the value is invalid or nil, returns an invalid reflect.Value.

func StripInterfaceValue added in v0.5.33

func StripInterfaceValue(v interface{}) interface{}

StripInterfaceValue takes an interface{} and returns the underlying value by recursively stripping off interface{} and pointer types.

For example: - string -> string value - interface{}(string) -> string value - *string -> string value - interface{}(*string) -> string value - *interface{}(string) -> string value - interface{}(*interface{}(string)) -> string value

If the value is nil, returns nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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