safe_reflectv3

package
v1.2.48 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MapElemType = "~map_elem_r_type~"

Variables

This section is empty.

Functions

func Any

func Any(rv reflect.Value) any

func Anys

func Anys(rv []reflect.Value) []any

func ToAnySlice added in v1.2.48

func ToAnySlice(i any) []any

ToAnySlice []Tpl -> []any [N]Tpl -> []any Tpl -> []any

Types

type ETv

type ETv struct {
	Tv
	*FieldOmit
}

func (*ETv) OmitRead

func (etv *ETv) OmitRead(s ...string) *ETv

func (*ETv) OmitReadByTag2

func (etv *ETv) OmitReadByTag2(tagKey, valKey, valVal string) *ETv

func (*ETv) OmitWrite

func (etv *ETv) OmitWrite(s ...string) *ETv

func (*ETv) StructFields

func (etv *ETv) StructFields() Fields

type FieldOmit

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

func NewFieldOmit

func NewFieldOmit() *FieldOmit

type Fields

type Fields map[string]reflect.StructField

type MapKeyElem added in v1.2.48

type MapKeyElem struct {
	Key  reflect.Value
	Elem reflect.Value
}

type MetaElemCate

type MetaElemCate int8

type T

type T struct {
	reflect.Type
}

func NewT

func NewT(i any) T

func WrapT

func WrapT(rt reflect.Type) T

func (T) ArrayElemNew added in v1.2.46

func (t T) ArrayElemNew() Tv

func (T) ArrayStructFields

func (t T) ArrayStructFields() Fields

func (T) ArrayStructTags

func (t T) ArrayStructTags(tagKey string) Tags

func (T) ArrayStructTypes

func (t T) ArrayStructTypes() Types

func (T) CanElem

func (t T) CanElem() bool

func (T) CanSet

func (t T) CanSet(st reflect.Type) bool

func (T) FieldType

func (t T) FieldType() Types

func (T) Indirect

func (t T) Indirect() T

func (T) IndirectElem added in v1.2.48

func (t T) IndirectElem() T

func (T) MapElemNew added in v1.2.46

func (t T) MapElemNew() Tv

func (T) MapElemType

func (t T) MapElemType() reflect.Type

func (T) MapKeyType added in v1.2.48

func (t T) MapKeyType() reflect.Type

func (T) New added in v1.2.46

func (t T) New() Tv

func (T) NewElem added in v1.2.46

func (t T) NewElem() Tv

func (T) SliceElemNew added in v1.2.46

func (t T) SliceElemNew() Tv

func (T) SliceStructFields

func (t T) SliceStructFields() Fields

func (T) SliceStructTags

func (t T) SliceStructTags(tagKey string) Tags

func (T) SliceStructTypes

func (t T) SliceStructTypes() Types

func (T) StructFields

func (t T) StructFields() Fields

func (T) StructRawTag added in v1.2.48

func (t T) StructRawTag(tagKey string) map[string]string

func (T) StructTags

func (t T) StructTags(tagKey string) Tags

func (T) StructTypes

func (t T) StructTypes() Types

func (T) Tag1

func (t T) Tag1(tagKey string) (raw map[string]string)

func (T) Tag2

func (t T) Tag2(tagKey, valKey string) map[string]string

func (T) Tag2VName

func (t T) Tag2VName(tagKey, valKey string) map[string]string

func (T) Tags

func (t T) Tags(tagKey string) (tags Tags)

type Tag

type Tag map[string]string

func ParseTagValue added in v1.2.48

func ParseTagValue(s string) (tag Tag)

type Tags

type Tags map[string]Tag

type Tv

type Tv struct {
	T
	V
}

func Direct

func Direct(i any) Tv

func Indirect

func Indirect(i any) Tv

Indirect if i is-valid; return Indirect T, Indirect V if i is-not-valid; return Direct T, Direct V

func Wrap

func Wrap(rv reflect.Value) Tv

func WrapI added in v1.2.48

func WrapI(rv reflect.Value) Tv

func (Tv) ArrayMapValues added in v1.2.48

func (tv Tv) ArrayMapValues() []map[string]any

func (Tv) ArrayStructValues

func (tv Tv) ArrayStructValues() []map[string]any

func (Tv) CallMethod

func (tv Tv) CallMethod(name string, args []any) (rets []any, called bool)

func (Tv) ETv

func (tv Tv) ETv() *ETv

func (Tv) FuncCall

func (tv Tv) FuncCall(in []any) (out []any, called bool)

func (Tv) Indirect

func (tv Tv) Indirect() Tv

func (Tv) SliceMapValues added in v1.2.48

func (tv Tv) SliceMapValues() []map[string]any

func (Tv) SliceStructValues

func (tv Tv) SliceStructValues() []map[string]any

func (Tv) StructToMap

func (tv Tv) StructToMap() map[string]any

func (Tv) StructValues

func (tv Tv) StructValues() map[string]any

func (Tv) Values

func (tv Tv) Values() []map[string]any

type Types

type Types map[string]reflect.Type

type V

type V struct {
	reflect.Value
}

func NewV

func NewV(i any) V

func NewVI added in v1.2.48

func NewVI(i any) V

func WrapV

func WrapV(rv reflect.Value) V

func WrapVI added in v1.2.48

func WrapVI(rv reflect.Value) V

func (V) ArrayCallMethod

func (v V) ArrayCallMethod(name string, args []any) (rets []any, called bool)

func (V) ArrayMapSetField added in v1.2.48

func (v V) ArrayMapSetField(index int, nv map[string]any)

func (V) ArrayMapSetField2 added in v1.2.48

func (v V) ArrayMapSetField2(nv map[string]any)

func (V) ArraySet added in v1.2.45

func (v V) ArraySet(index int, i any)

func (V) ArrayStructSetField

func (v V) ArrayStructSetField(index int, nv map[string]any)

func (V) ArrayStructSetField2 added in v1.2.48

func (v V) ArrayStructSetField2(nv map[string]any)

func (V) CallMethod

func (v V) CallMethod(name string, args []any) (rets []any, called bool)

func (V) CanElem

func (v V) CanElem() bool

func (V) I added in v1.2.46

func (v V) I() any

func (V) Indirect

func (v V) Indirect() V

func (V) IterIndex added in v1.2.48

func (v V) IterIndex() iter.Seq2[int, reflect.Value]

func (V) MapDeleteZero

func (v V) MapDeleteZero()

func (V) MapRange

func (v V) MapRange() []MapKeyElem

func (V) MapSetField

func (v V) MapSetField(nv map[string]any)

func (V) MapValues

func (v V) MapValues() map[string]any

func (V) SetField

func (v V) SetField(nv map[string]any)

func (V) SetI added in v1.2.45

func (v V) SetI(i any)

func (V) SliceAppend added in v1.2.45

func (v V) SliceAppend(i any)

func (V) SliceCallMethod

func (v V) SliceCallMethod(name string, args []any) (rets []any, called bool)

func (V) SliceMapSetField added in v1.2.48

func (v V) SliceMapSetField(index int, nv map[string]any)

func (V) SliceMapSetField2 added in v1.2.48

func (v V) SliceMapSetField2(nv map[string]any)

func (V) SliceSet added in v1.2.45

func (v V) SliceSet(index int, i any)

func (V) SliceStructSetField

func (v V) SliceStructSetField(index int, nv map[string]any)

func (V) SliceStructSetField2 added in v1.2.48

func (v V) SliceStructSetField2(nv map[string]any)

func (V) StructSet

func (v V) StructSet(nv map[string]any)

type Values

type Values map[string]reflect.Value

Jump to

Keyboard shortcuts

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