zreflect

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSkipStruct Field is returned when a struct field is skipped.
	ErrSkipStruct = errors.New("skip struct")
)
View Source
var (
	Tag = "z"
)

Functions

func CanExpand

func CanExpand(t reflect.Type) bool

func CanInline

func CanInline(t reflect.Type) bool

func CheckExistsField

func CheckExistsField(typeName, fieldName string) (index int, exists bool)

CheckExistsField check field is exists by name

func GetFieldTypName

func GetFieldTypName(typName, fieldName string) string

func GetInterfaceField

func GetInterfaceField(v reflect.Value, i int) reflect.Value

func GetStructTag

func GetStructTag(field reflect.StructField) (tagValue string)

func IsLabelType

func IsLabelType(t reflect.Type) bool

func MapToStruct

func MapToStruct(from map[string]interface{}, obj interface{}) error

func MapTypStruct

func MapTypStruct(from map[string]interface{}, t *Typer) error

func Nonzero

func Nonzero(v reflect.Value) bool

func Register

func Register(obj interface{}) error

func SetStructFidld

func SetStructFidld(typName, tag string, fValue reflect.Value, val interface{}) error

func TypeOf

func TypeOf(obj interface{}) reflect.Type

func ValueOf

func ValueOf(obj interface{}) (v reflect.Value, err error)

Types

type Typer

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

func NewTyp

func NewTyp(typ reflect.Type) (*Typer, error)

func NewVal

func NewVal(val reflect.Value) (*Typer, error)

func (*Typer) CheckExistsField

func (t *Typer) CheckExistsField(name string) (int, bool)

func (*Typer) Field

func (t *Typer) Field(i int) reflect.StructField

func (*Typer) ForEach

func (t *Typer) ForEach(fn func(parent []string, index int, tag string, field reflect.StructField) error) (err error)

ForEach For Each Struct field

func (*Typer) ForEachMethod

func (t *Typer) ForEachMethod(fn func(index int, method reflect.Method, value reflect.Value) error) error

func (*Typer) ForEachVal

func (t *Typer) ForEachVal(fn func(parent []string, index int, tag string, field reflect.StructField, val reflect.Value) error) (err error)

ForEachVal For Each Struct field

func (*Typer) GetFieldTypName

func (t *Typer) GetFieldTypName(name string) string

func (*Typer) Name

func (t *Typer) Name() string

func (*Typer) TypeOf

func (t *Typer) TypeOf() reflect.Type

func (*Typer) ValueOf

func (t *Typer) ValueOf() reflect.Value

Jump to

Keyboard shortcuts

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