Documentation ¶
Index ¶
- Variables
- func ArrayIsZero(v reflect.Value) bool
- func ArrayIsZerov(v *reflect.Value) bool
- func CanConvert(v *reflect.Value, t reflect.Type) bool
- func CanConvertHelper(v reflect.Value, t reflect.Type) bool
- func HasStringer(v *reflect.Value) bool
- func IsExported(f *reflect.StructField) bool
- func IsMap(v any) bool
- func IsNil(v reflect.Value) bool
- func IsNilT[T any](id T) (ret bool)
- func IsNilv(v *reflect.Value) bool
- func IsNumComplexKind(k reflect.Kind) bool
- func IsNumFloatKind(k reflect.Kind) bool
- func IsNumIntegerKind(k reflect.Kind) bool
- func IsNumIntegerType(t reflect.Type) bool
- func IsNumSIntegerKind(k reflect.Kind) bool
- func IsNumUIntegerKind(k reflect.Kind) bool
- func IsNumeric(v any) bool
- func IsNumericKind(k reflect.Kind) bool
- func IsNumericType(t reflect.Type) bool
- func IsSlice(v any) bool
- func IsValid(v reflect.Value) bool
- func IsValidv(v *reflect.Value) bool
- func IsZero(v reflect.Value) (ret bool)
- func IsZerov(v *reflect.Value) (ret bool)
- func Iserrortype(typ reflect.Type) bool
- func KindIs(k reflect.Kind, list ...reflect.Kind) bool
- func Rdecode(reflectValue reflect.Value) (ret, prev reflect.Value)
- func Rdecodesimple(reflectValue reflect.Value) (ret reflect.Value)
- func Rdecodetype(reflectType reflect.Type) (ret, prev reflect.Type)
- func Rdecodetypesimple(reflectType reflect.Type) (ret reflect.Type)
- func Rindirect(reflectValue reflect.Value) reflect.Value
- func RindirectType(reflectType reflect.Type) reflect.Type
- func Rskip(reflectValue reflect.Value, kinds ...reflect.Kind) (ret, prev reflect.Value)
- func Rskiptype(reflectType reflect.Type, kinds ...reflect.Kind) (ret, prev reflect.Type)
- func Rwant(reflectValue reflect.Value, kinds ...reflect.Kind) reflect.Value
- func SliceAppend(vv ...any) (ret any)
- func SliceMerge(vv ...any) (ret any)
- func StructIsZero(v reflect.Value) bool
- func StructIsZerov(v *reflect.Value) bool
- func Typfmt(t reflect.Type) string
- func Typfmtptr(t *reflect.Type) string
- func Typfmtv(v *reflect.Value) string
- func Typfmtvlite(v *reflect.Value) string
- func Valfmt(v *reflect.Value) string
- func ValfmtPure(v *reflect.Value) string
- func Valfmtptr(v *reflect.Value) string
- func ValfmtptrPure(v *reflect.Value) string
- func Valfmtv(v reflect.Value) string
Constants ¶
This section is empty.
Variables ¶
var Niltyp = reflect.TypeOf((*string)(nil)) //nolint:gochecknoglobals //i know that
var StringType = reflect.TypeOf((*string)(nil)).Elem() //nolint:gochecknoglobals //i know that
Functions ¶
func ArrayIsZero ¶
func ArrayIsZerov ¶
func CanConvert ¶
CanConvert reports whether the value v can be converted to type t. If v.CanConvert(t) returns true then v.Convert(t) will not panic.
func CanConvertHelper ¶
CanConvertHelper is a shorthand of CanConvert.
func HasStringer ¶
func IsExported ¶
func IsExported(f *reflect.StructField) bool
IsExported reports whether the field is exported.
func IsNil ¶
IsNil for go1.12+, the difference is it never panic on unavailable kinds. see also reflect.IsNil.
func IsNilv ¶
IsNilv for go1.12+, the difference is it never panic on unavailable kinds. see also reflect.IsNil.
func IsNumComplexKind ¶
func IsNumFloatKind ¶
func IsNumIntegerKind ¶
func IsNumIntegerType ¶
func IsNumSIntegerKind ¶
func IsNumUIntegerKind ¶
func IsNumericKind ¶
func IsNumericType ¶
func IsZero ¶
IsZero for go1.12+, the difference is it never panic on unavailable kinds. see also reflect.IsZero.
func IsZerov ¶
IsZerov for go1.12+, the difference is it never panic on unavailable kinds. see also reflect.IsZero.
func Iserrortype ¶
func Rdecode ¶
Rdecode decodes an interface{} or a pointer to something to its underlying data type.
Suppose we have an interface{} pointer Value which stored a pointer to an integer, Rdecode will extract or retrieve the Value of that integer.
See our TestRdecode() in ref_test.go
var b = 11 var i interface{} = &b var v = reflect.ValueOf(&i) var n = Rdecode(v) println(n.Type()) // = int
`prev` returns the previous Value before we arrived at the final `ret` Value. In another word, the value of `prev` Value is a pointer which points to the value of `ret` Value. Or, it's a interface{} wrapped about `ret`.
A interface{} will be unboxed to its underlying datatype after Rdecode invoked.
func Rdecodesimple ¶
Rdecodesimple is a shortcut to Rdecode without `prev` returned.
func Rdecodetype ¶
Rdecodetype try to strip off ptr and interface{} from a type.
It might not work properly on some cases because interface{} cannot be stripped with calling typ.Elem().
In this case, use rdecodesimple(value).Type() instead of Rdecodetypesimple(value.Type()).
func Rdecodetypesimple ¶
Rdecodetypesimple try to strip off ptr and interface{} from a type.
It might not work properly on some cases because interface{} cannot be stripped with calling typ.Elem(). For this case, use Rdecodesimple(value).Type() instead of Rdecodetypesimple(value.Type()).
func SliceAppend ¶
SliceAppend combines all given slices ('vv') as one result slice. That is, SliceAppend([]int{1,2}, []int{2,3}) will return []int{1,2,2,3}.
func SliceMerge ¶
SliceMerge merge all given slices ('vv') as one result slice. That is, SliceAppend([]int{1,2}, []int{2,3}) will return []int{1,2,3}.
func StructIsZero ¶
func StructIsZerov ¶
func Typfmtvlite ¶
func ValfmtPure ¶
func ValfmtptrPure ¶
ValfmtptrPure will step into a ptr value at first, then Valfmt.
Types ¶
This section is empty.