Documentation
¶
Overview ¶
Package refavour provides interface to work with tags of struct and several functions for working with reflect
Index ¶
- func CheckCanBeChanged(value interface{}) error
- func CheckKind(value interface{}, expectedKind reflect.Kind) error
- func CheckMap(data interface{}) error
- func CheckSlice(data interface{}) error
- func CheckStructure(data interface{}) error
- func GetReflectValue(s interface{}) reflect.Value
- type FieldsInfo
- type TagProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCanBeChanged ¶
func CheckCanBeChanged(value interface{}) error
CheckCanBeChanged Check whether the data receiver can be changed
func CheckKind ¶
CheckKind check is that interface{} equal expected Kind if equal then return nil else return ge.MismatchError
func CheckMap ¶
func CheckMap(data interface{}) error
CheckMap check is that interface{} map if map then return nil else return ge.MismatchError
func CheckSlice ¶
func CheckSlice(data interface{}) error
CheckSlice check is that interface{} slice if slice then return nil else return ge.MismatchError
func CheckStructure ¶
func CheckStructure(data interface{}) error
CheckStructure check is that interface{} struct if struct then return nil else return ge.MismatchError
func GetReflectValue ¶
GetReflectValue return reflect.Value of interface{}
Types ¶
type FieldsInfo ¶
type FieldsInfo map[string]interface{}
FieldsInfo Types of structure fields
func GetStructureFieldsTypes ¶
func GetStructureFieldsTypes(value interface{}, tagProcessor TagProcessor) (FieldsInfo, error)
GetStructureFieldsTypes reads the structure from the interface and generates a list of field names and their types
type TagProcessor ¶ added in v0.0.14
type TagProcessor interface {
GetFieldInfo(typeField reflect.StructField, valueField reflect.Value) (interface{}, error)
}
TagProcessor interface to provide parsing tags of struct