reflectionutils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToSlice

func ArrayToSlice(reflectedArray reflect.Value) any

ArrayToSlice converts a reflected array into a slice. Returns the slice.

func CopyReflectedType

func CopyReflectedType(reflectedValue reflect.Value) reflect.Value

CopyReflectedType creates a shallow copy of a reflected value. It supports slices, arrays, or structs. This method panics if an array, slice, or struct type is not provided. Returns the reflected copied value.

func GetField

func GetField(field reflect.Value) any

GetField obtains a given field even if it is unexported.

func GetReflectedArrayValues

func GetReflectedArrayValues(reflectedArray reflect.Value) []any

GetReflectedArrayValues obtains the values of each element of a reflected array or slice variable. This method panics if an array or slice type is not provided. Returns a slice containing all values of each element in the provided array or slice.

func SetField

func SetField(field reflect.Value, value any)

SetField sets a given field's value, even if it is unexported.

func SetReflectedArrayValues

func SetReflectedArrayValues(reflectedArray reflect.Value, values []any) error

SetReflectedArrayValues takes an array or slice of the same length as the values provided, and sets each element to the corresponding element of the values provided. Returns an error if one occurred during value setting.

func SliceToArray

func SliceToArray(reflectedSlice reflect.Value) any

SliceToArray converts a reflected slice into an array of the same size. Returns the array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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