reflector

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldCanNotBeSetError = errors.New("field can not be set")
View Source
var InvalidFuncError = errors.New("func is invalid")
View Source
var InvalidInputError = errors.New("input is invalid")
View Source
var InvalidMethodError = errors.New("method is invalid")

Functions

func CallFunc added in v0.4.0

func CallFunc(object interface{}, args ...interface{}) (interface{}, error)

func CallMethodByName

func CallMethodByName(object interface{}, name string, args ...interface{}) (interface{}, error)

func DeepFields

func DeepFields(reflectType reflect.Type) []reflect.StructField

func GetEmbeddedInterfaceField added in v0.5.0

func GetEmbeddedInterfaceField(object interface{}) (field reflect.StructField)

func GetFieldValue

func GetFieldValue(f interface{}, name string) reflect.Value

func GetKind

func GetKind(kind reflect.Kind) reflect.Kind

func GetKindByType added in v0.5.0

func GetKindByType(typ reflect.Type) reflect.Kind

func GetKindByValue added in v0.5.0

func GetKindByValue(val reflect.Value) reflect.Kind

func GetLowerCaseObjectName

func GetLowerCaseObjectName(data interface{}) (string, error)

func GetName

func GetName(data interface{}) (name string, err error)

func GetPkgPath added in v0.3.0

func GetPkgPath(object interface{}) string

func GetType added in v0.5.0

func GetType(data interface{}) (typ reflect.Type, err error)

func HasEmbeddedField

func HasEmbeddedField(object interface{}, name string) bool

func HasField

func HasField(object interface{}, name string) bool

func Indirect

func Indirect(reflectValue reflect.Value) reflect.Value

func IndirectType

func IndirectType(reflectType reflect.Type) reflect.Type

func NewReflectType

func NewReflectType(st interface{}) interface{}

func ParseObjectName added in v0.3.0

func ParseObjectName(obj interface{}, eliminator string) string

ParseObjectName e.g. ExampleObject => example

func ParseObjectPkgName added in v0.4.0

func ParseObjectPkgName(obj interface{}) string

ParseObjectName e.g. ExampleObject => example

func SetFieldValue

func SetFieldValue(object interface{}, name string, value interface{}) error

func Validate

func Validate(toValue interface{}) (*reflect.Value, error)

func ValidateReflectType

func ValidateReflectType(obj interface{}, callback func(value *reflect.Value, reflectType reflect.Type, fieldSize int, isSlice bool) error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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