Documentation
¶
Overview ¶
Package reflectx holds pure reflection helpers extracted from the validate root package. It depends only on goutil and never imports the root package, keeping the dependency direction one-way (root -> internal/reflectx).
Index ¶
- Variables
- func ConvToBasicType(val any) (value any, err error)
- func ConvTypeByBaseKind(srcVal any, dstType reflect.Kind) (any, error)
- func GetVariadicKind(typ reflect.Type) reflect.Kind
- func IndirectValue(input any) any
- func IsNilObj(val any) bool
- func RemoveValuePtr(t reflect.Value) reflect.Value
- func ValueCompare(srcVal, dstVal any, op string) (ok bool)
- type NilObject
Constants ¶
This section is empty.
Variables ¶
var ErrConvertFail = errors.New("convert value is failure")
ErrConvertFail error. Mirrors validate.ErrConvertFail; kept as a separate value because consumers only test err != nil, never the identity.
var NilRVal = reflect.ValueOf(nilObj)
NilRVal a reflect nil value (= reflect.ValueOf(NilObject{})).
Functions ¶
func ConvToBasicType ¶
ConvToBasicType convert custom type to generic basic int, string, unit. returns string, int64 or error
func ConvTypeByBaseKind ¶
ConvTypeByBaseKind convert value type by base kind
func IndirectValue ¶
IndirectValue dereferences a single pointer level of the input value.
func RemoveValuePtr ¶
RemoveValuePtr removes value multiple pointer