Documentation ¶
Index ¶
- Variables
- func CallFunc(object interface{}, args ...interface{}) (interface{}, error)
- func CallMethodByName(object interface{}, name string, args ...interface{}) (interface{}, error)
- func DeepFields(reflectType reflect.Type) []reflect.StructField
- func FindEmbeddedFieldTag(object interface{}, name string) (t string, ok bool)
- func GetEmbeddedInterfaceField(object interface{}) (field reflect.StructField)
- func GetEmbeddedInterfaceFieldByType(typ reflect.Type) (field reflect.StructField)
- func GetFieldValue(f interface{}, name string) reflect.Value
- func GetKind(kind reflect.Kind) reflect.Kind
- func GetKindByType(typ reflect.Type) reflect.Kind
- func GetKindByValue(val reflect.Value) reflect.Kind
- func GetLowerCaseObjectName(data interface{}) (string, error)
- func GetName(data interface{}) (name string, err error)
- func GetPkgPath(object interface{}) string
- func GetType(data interface{}) (typ reflect.Type, err error)
- func HasEmbeddedField(object interface{}, name string) bool
- func HasField(object interface{}, name string) bool
- func Indirect(reflectValue reflect.Value) reflect.Value
- func IndirectType(reflectType reflect.Type) reflect.Type
- func NewReflectType(st interface{}) interface{}
- func ParseObjectName(obj interface{}, eliminator string) string
- func ParseObjectPkgName(obj interface{}) string
- func SetFieldValue(object interface{}, name string, value interface{}) error
- func Validate(toValue interface{}) (*reflect.Value, error)
- func ValidateReflectType(obj interface{}, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidInput means that the input is invalid ErrInvalidInput = errors.New("input is invalid") // ErrInvalidMethod means that the method is invalid ErrInvalidMethod = errors.New("method is invalid") // ErrInvalidFunc means that the func is invalid ErrInvalidFunc = errors.New("func is invalid") // ErrFieldCanNotBeSet means that the field can not be set ErrFieldCanNotBeSet = errors.New("field can not be set") )
Functions ¶
func CallFunc ¶ added in v0.4.0
func CallFunc(object interface{}, args ...interface{}) (interface{}, error)
CallFunc call function
func CallMethodByName ¶
CallMethodByName call method
func DeepFields ¶
func DeepFields(reflectType reflect.Type) []reflect.StructField
DeepFields iterate struct field
func FindEmbeddedFieldTag ¶ added in v0.8.0
FindEmbeddedFieldTag find embedded field tag
func GetEmbeddedInterfaceField ¶ added in v0.5.0
func GetEmbeddedInterfaceField(object interface{}) (field reflect.StructField)
GetEmbeddedInterfaceField get embedded interface field
func GetEmbeddedInterfaceFieldByType ¶ added in v0.5.4
func GetEmbeddedInterfaceFieldByType(typ reflect.Type) (field reflect.StructField)
GetEmbeddedInterfaceFieldByType get embedded interface field by type
func GetFieldValue ¶
GetFieldValue get field value
func GetKindByType ¶ added in v0.5.0
GetKindByType get kind by type
func GetKindByValue ¶ added in v0.5.0
GetKindByValue get kind by value
func GetLowerCaseObjectName ¶
GetLowerCaseObjectName get lower case object name
func GetPkgPath ¶ added in v0.3.0
func GetPkgPath(object interface{}) string
GetPkgPath get the package patch
func GetType ¶ added in v0.5.0
GetType get object data type
func HasEmbeddedField ¶
HasEmbeddedField check if has embedded fieled
func HasField ¶
HasField check if has specific field
func IndirectType ¶
IndirectType get indirect type
func NewReflectType ¶
func NewReflectType(st interface{}) interface{}
NewReflectType create instance by tyep
func ParseObjectName ¶ added in v0.3.0
ParseObjectName e.g. ExampleObject => example
func ParseObjectPkgName ¶ added in v0.4.0
func ParseObjectPkgName(obj interface{}) string
ParseObjectName e.g. ExampleObject => example
func SetFieldValue ¶
SetFieldValue set field value
Types ¶
This section is empty.