Documentation
¶
Index ¶
- Variables
- func GetElementType(any interface{}) reflect.Type
- func GetElementTypeMaxTry(any interface{}, maxTry int) reflect.Type
- func GetElementTypesMaxTry(any interface{}, maxTries int) (finalType reflect.Type, visitedTypes []reflect.Type)
- func GetFieldValue(field reflect.Value) interface{}
- func GetTypeName(any interface{}) string
- func IsBoolean(any interface{}) (isBool bool, isResult bool)
- func IsBooleanPointer(any interface{}) (isBool bool, isResult *bool)
- func IsByte(any interface{}) (isByte bool, result byte)
- func IsBytesOrBytesPointer(any interface{}) (isBytes bool, bytesPtr *[]byte)
- func IsFloat64sOrFloat64sPointer(any interface{}) (isFloat64 bool, floats *[]float64)
- func IsInteger(any interface{}) (isInteger bool, intValue int)
- func IsIntegerOrIntegerPointer(any interface{}) (isInteger bool, intPtr *int)
- func IsIntegersOrIntegersPointer(any interface{}) (isIntegers bool, integersResults *[]int)
- func IsString(any interface{}) (isStrings bool, str string)
- func IsStringOrStringPointer(any interface{}) (isString bool, stringPointer *string)
- func IsStringsOrStringsPointer(any interface{}) (isStrings bool, stringsPtr *[]string)
- func IsType(any interface{}, typeName string) bool
- func IsTypeSame(type1 reflect.Type, type2 reflect.Type) bool
- type PointerInfo
- type ScanReport
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Uint8sType = reflect.ValueOf([]byte{}).Type() BytesType = Uint8sType StringsType = reflect.ValueOf([]string{}).Type() StringType = reflect.ValueOf("").Type() IntegersType = reflect.ValueOf([]int{}).Type() IntegerType = reflect.ValueOf(0).Type() BooleanType = reflect.ValueOf(false).Type() Int64sType = reflect.ValueOf([]int64{}).Type() Float64sType = reflect.ValueOf([]float64{}).Type() BooleansType = reflect.ValueOf([]bool{}).Type() AnyType = reflect.ValueOf([]interface{}{}).Type() )
Functions ¶
func GetElementTypeMaxTry ¶
Examples:
func GetElementTypesMaxTry ¶
func GetElementTypesMaxTry(any interface{}, maxTries int) (finalType reflect.Type, visitedTypes []reflect.Type)
Examples:
func GetFieldValue ¶
Example
actualValueOf := reflect.ValueOf(*actual) for i := 0; i < actualValueOf.NumField(); i++ { actualFieldValue := GetFieldValue(actualValueOf.Field(i)) expectedFieldValue := GetFieldValue(reflect.ValueOf(expectedNewEmptyDirectoryResult).Field(i))
func GetTypeName ¶
func GetTypeName(any interface{}) string
func IsBooleanPointer ¶
func IsBytesOrBytesPointer ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
func IsInteger ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
func IsIntegerOrIntegerPointer ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
func IsIntegersOrIntegersPointer ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
func IsString ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
func IsStringOrStringPointer ¶
Examples : https://play.golang.org/p/9XUt9Jf11WG | https://play.golang.org/p/oMAxxSzAP7F
Types ¶
type PointerInfo ¶
func GetPointerInfo ¶
func GetPointerInfo(any interface{}) PointerInfo
type ScanReport ¶
type ScanReport struct { ReflectionValue *reflect.Value IndirectReflectionValue *reflect.Value ReflectionType reflect.Type IndirectReflectionType *reflect.Type VisitedTypes *[]reflect.Type FinalDeductedType reflect.Type IsPointer bool IsInterface bool IsInt bool IsBool bool IsByte bool IsString bool IsSlice bool IsMap bool IsFunc bool IsArray bool TypeName string }
func NewScanReport ¶
func NewScanReport(any interface{}, maxTries int) ScanReport
Example : https://play.golang.org/p/lHol_zbu4Pn
Click to show internal directories.
Click to hide internal directories.