reflection

package
v2.16.4 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopyByGob added in v2.2.5

func DeepCopyByGob(dst, src any) error

DeepCopyByGob 深拷贝

func IsSameDeepEqual added in v2.2.5

func IsSameDeepEqual(a, b any) bool

IsSameDeepEqual 判断两个值是否相同

func IsSameType added in v2.2.5

func IsSameType(a, b any) bool

IsSameType 判断两个类型是否相同

func ValueToInterface

func ValueToInterface(v reflect.Value) (value interface{}, ok bool)

ValueToInterface converts reflect value to its interface type.

Types

type OriginTypeAndKindOutput

type OriginTypeAndKindOutput struct {
	InputType  reflect.Type
	InputKind  reflect.Kind
	OriginType reflect.Type
	OriginKind reflect.Kind
}

func OriginTypeAndKind

func OriginTypeAndKind(value interface{}) (out OriginTypeAndKindOutput)

OriginTypeAndKind retrieves and returns the original reflect type and kind.

type OriginValueAndKindOutput

type OriginValueAndKindOutput struct {
	InputValue  reflect.Value
	InputKind   reflect.Kind
	OriginValue reflect.Value
	OriginKind  reflect.Kind
}

func OriginValueAndKind

func OriginValueAndKind(value interface{}) (out OriginValueAndKindOutput)

OriginValueAndKind retrieves and returns the original reflect value and kind.

type Reflection added in v2.16.1

type Reflection struct {
	// contains filtered or unexported fields
}
var ReflectionHelper Reflection

func (*Reflection) CallMethodByName added in v2.16.1

func (r *Reflection) CallMethodByName(methodName string, values ...reflect.Value) []reflect.Value

CallMethodByName 通过名称调用方法

func (*Reflection) GetType added in v2.16.1

func (r *Reflection) GetType() reflect.Type

GetType 获取reflect.Type

func (*Reflection) GetValue added in v2.16.1

func (r *Reflection) GetValue() reflect.Value

GetValue 获取reflect.Value

func (*Reflection) IsSame added in v2.16.2

func (r *Reflection) IsSame(value any) bool

IsSame 判断两个类型是否相等

func (Reflection) New added in v2.16.1

func (Reflection) New(obj any) *Reflection

New 实例化:反射帮助

Jump to

Keyboard shortcuts

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