qreflect

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reflect

type Reflect struct {
	// contains filtered or unexported fields
}

func New

func New(object interface{}) *Reflect

New

@Description: 创建反射实例
@param object 任意对象
@return Reflect

func (*Reflect) Clear

func (r *Reflect) Clear()

Clear

@Description: 清空切片

func (*Reflect) Get

func (r *Reflect) Get(name string) interface{}

Get

@Description: 获取属性值
@param name 属性名
@return interface

func (*Reflect) Interface

func (r *Reflect) Interface() interface{}

Interface

@Description: 返回对象
@return interface{}

func (*Reflect) InterfaceArray

func (r *Reflect) InterfaceArray() []interface{}

InterfaceArray

@Description: 返回对象
@return interface{}

func (*Reflect) IsMap

func (r *Reflect) IsMap() bool

IsMap

@Description: 是否是字典
@return bool

func (*Reflect) IsPtr

func (r *Reflect) IsPtr() bool

IsPtr

@Description: 判断是否是指针
@receiver r
@return bool

func (*Reflect) IsSlice

func (r *Reflect) IsSlice() bool

IsSlice

@Description: 是否是切片
@return bool

func (*Reflect) Set

func (r *Reflect) Set(name string, value interface{}) error

Set

@Description: 设置属性值
@param name 属性名
@param value 值
@return error

func (*Reflect) SetAny

func (r *Reflect) SetAny(mapOrStructOrSlice ...interface{}) error

SetAny

@Description: 将任意对象写入到对象中
@param mapOrStructOrSlice 字典、结构体、切片
@return error

func (*Reflect) ToMap

func (r *Reflect) ToMap() map[string]interface{}

ToMap

@Description: 转为字典
@return map[string]interface{}

func (*Reflect) ToMapExpandAll

func (r *Reflect) ToMapExpandAll() map[string]interface{}

ToMapExpandAll

@Description: 转为字典,此方法会遍历所有字典值,将值为json字符串的再次展开
@return map[string]

func (*Reflect) ToMaps

func (r *Reflect) ToMaps() []map[string]interface{}

ToMaps

@Description: 转为字典列表
@return []map[string]interface{}

Jump to

Keyboard shortcuts

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