reflectutil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnonymousField added in v0.0.3

func GetAnonymousField(obj interface{}) (res []reflect.StructField)

GetAnonymousField 获取匿名结构体字段

func GetAnonymousOrNoneTypeNameField added in v0.0.3

func GetAnonymousOrNoneTypeNameField(obj interface{}) (res []reflect.StructField)

GetAnonymousOrNoneTypeNameField 获取匿名和未命名嵌套结构体字段

func GetFunctionName

func GetFunctionName(i interface{}, seps ...rune) string

GetFunctionName 获取函数名称

func GetNotPtrRefType added in v0.0.3

func GetNotPtrRefType(obj interface{}) reflect.Type

GetNotPtrRefType 获取结构体的字段类型

func GetStructFieldRefValue added in v0.0.3

func GetStructFieldRefValue(src interface{}, fieldName string) (reflect.Value, error)

GetStructFieldRefValue 获取结构体的值

func GetStructFieldType

func GetStructFieldType(obj interface{}, fieldName string) (reflect.Type, error)

GetStructFieldType 获取结构体的类型

func GetStructFields added in v0.0.3

func GetStructFields(obj interface{}) (res []reflect.StructField)

GetStructFields 获取结构体的字段

func GetTagFieldName added in v0.0.3

func GetTagFieldName(tagName string, ptr interface{}) (rs []string)

GetTagFieldName 获取结构体, 含有tagName的字段

func GetTagValues

func GetTagValues(tagName string, obj interface{}) (rs map[string]string)

GetTagValues 获取结构体, 含有tagName的字段和值

func Invoke

func Invoke(src interface{}, method string, params ...interface{}) []reflect.Value

Invoke 调用src里的方法, 返回 []reflect.Value

func SetInterfaceValueUnSafe

func SetInterfaceValueUnSafe(dst interface{}, val interface{}) error

SetInterfaceValueUnSafe 给接口类型的src赋值val

func SetStructFieldValue

func SetStructFieldValue(dstStruct interface{}, fieldName string, val interface{}) error

SetStructFieldValue 给结构体里内指定的成员变量赋值

func SetStructFieldValueUnSafe

func SetStructFieldValueUnSafe(dstStruct interface{}, targetField string, obj interface{}) error

SetStructFieldValueUnSafe 给结构体里的成员字段赋值 - 可以设置私有值

Types

This section is empty.

Jump to

Keyboard shortcuts

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