refl

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckImplements added in v1.0.1

func CheckImplements[T any, I any]() bool

检查结构体是否实现了接口

func GetFieldValue

func GetFieldValue(obj any, fieldName string) (any, error)

获取结构体字段的值

func IterFields

func IterFields(v interface{}, fn func(f reflect.StructField) error) error

遍历StructField

func SetFieldValue

func SetFieldValue(obj interface{}, fieldName string, value interface{}) error

使用反射设置结构体字段的值

func StructType

func StructType(v any) reflect.Type

获取数据的结构体类型

Types

type StructField

type StructField reflect.StructField

Jump to

Keyboard shortcuts

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