reflection

package
v2.21.10 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyType added in v2.21.10

type AnyType string

type Reflection added in v2.16.1

type Reflection struct {
	IsPtr  bool
	IsZero bool
	IsTime bool // 是否是时间
	// contains filtered or unexported fields
}

func New added in v2.16.8

func New(object any) *Reflection

New 实例化:反射帮助

func NewByReflectValue added in v2.19.12

func NewByReflectValue(refValue reflect.Value) *Reflection

NewByReflectValue 实例化:通过reflect.Value

func (*Reflection) CallMethodByName added in v2.16.1

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

CallMethodByName 通过名称调用方法

func (*Reflection) FindFieldAndFill added in v2.19.1

func (r *Reflection) FindFieldAndFill(
	target,
	tagTitle,
	tagField string,
	process func(val reflect.Value),
)

FindFieldAndFill 递归查找字段并填充

func (*Reflection) GetReflectionType added in v2.16.9

func (r *Reflection) GetReflectionType() ReflectionType

GetReflectionType 获取Reflection类型

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) IsSameDeepEqual added in v2.16.6

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

IsSameDeepEqual 判断两个值是否相等

type ReflectionType added in v2.16.9

type ReflectionType string
const (
	Int               ReflectionType = "I"
	Int8              ReflectionType = "I8"
	Int16             ReflectionType = "I16"
	Int32             ReflectionType = "I32"
	Int64             ReflectionType = "I64"
	Uint              ReflectionType = "U"
	Uint8             ReflectionType = "U8"
	Uint16            ReflectionType = "U16"
	Uint32            ReflectionType = "U32"
	Uint64            ReflectionType = "U64"
	String            ReflectionType = "S"
	Float32           ReflectionType = "F32"
	Float64           ReflectionType = "F64"
	Datetime          ReflectionType = "DT"
	Bool              ReflectionType = "BOOL"
	Array             ReflectionType = "ARR"
	Dict              ReflectionType = "DICT"
	Struct            ReflectionType = "STR"
	Nil               ReflectionType = "N"
	PtrSlicePtrStruct ReflectionType = "*[]*struct"
	PtrSliceStruct    ReflectionType = "*[]struct"
	PtrSliceMap       ReflectionType = "*[]map"
	PtrStruct         ReflectionType = "*struct"
	PtrPtrStruct      ReflectionType = "**struct"
	Any               ReflectionType = "any"
)

Jump to

Keyboard shortcuts

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