Documentation ¶
Index ¶
- Variables
- func IndirectType(typ reflect.Type) reflect.Type
- func IndirectValue(val reflect.Value) reflect.Value
- func IsError(typ interface{ ... }) bool
- func IsFunc(typ interface{ ... }) bool
- func IsZero(v interface{}) bool
- func LookupFields(typ reflect.Type, fieldTag string) []reflect.StructField
- func LookupUnderlineValueType(v reflect.Value) (reflect.Value, reflect.Type)
- type FuncParam
- type Zeroer
Constants ¶
This section is empty.
Variables ¶
var ( StringType = reflect.TypeOf("") BytesType = reflect.TypeOf([]byte{}) IntType = reflect.TypeOf(int(0)) Int16Type = reflect.TypeOf(int16(0)) Int32Type = reflect.TypeOf(int32(0)) Int64Type = reflect.TypeOf(int64(0)) Float32Type = reflect.TypeOf(float32(0)) Float64Type = reflect.TypeOf(float64(0)) TimeType = reflect.TypeOf(time.Time{}) IpTyp = reflect.TypeOf(net.IP{}) JSONNumberTyp = reflect.TypeOf(json.Number("")) StringerTyp = reflect.TypeOf((*fmt.Stringer)(nil)).Elem() ArrayIntegerTyp = reflect.TypeOf([]int{}) ArrayStringTyp = reflect.TypeOf([]string{}) DoubleArrayIntegerTyp = reflect.TypeOf([][]int{}) DoubleArrayStringTyp = reflect.TypeOf([][]string{}) ErrTyp = reflect.TypeOf((*error)(nil)).Elem() )
Common reflect types for go standard data types.
Functions ¶
func IndirectType ¶
IndirectType returns the value of a pointer-type "typ". If "IndirectType" is a pointer, array, chan, map or slice it returns its Elem, otherwise returns the "typ" as it is.
func IndirectValue ¶
IndirectValue returns the element type (e.g. if pointer of *User it will return the User type).
func IsZero ¶
func IsZero(v interface{}) bool
IsZero reports whether "v" is zero value or no. The given "v" value can complete the Zeroer interface which can be used to customize the behavior for each type of "v".
func LookupFields ¶
func LookupFields(typ reflect.Type, fieldTag string) []reflect.StructField
LookupFields returns a slice of all fields containing a struct field of the given "fieldTag" of the "typ" struct. The fields returned are flatted and reclusive over fields with value of struct. Panics if "typ" is not a type of Struct.
Types ¶
type FuncParam ¶
FuncParam holds the properties of function input or output.
func LookupInputs ¶
LookupInputs returns the index and type of each function's input argument. Panics if "fn" is not a type of Func.
func LookupOutputs ¶
LookupOutputs returns the index and type of each function's output argument. Panics if "fn" is not a type of Func.