Documentation
¶
Index ¶
- func CamelCaseToUnderscore(name string) string
- func CanBool(v reflect.Value) bool
- func CanBytes(v reflect.Value) bool
- func CanComplex(v reflect.Value) bool
- func CanDuration(v reflect.Value) bool
- func CanError(v reflect.Value) bool
- func CanFloat(v reflect.Value) bool
- func CanInt(v reflect.Value) bool
- func CanInterface(v reflect.Value) bool
- func CanMap(v reflect.Value) bool
- func CanNil(v reflect.Value) bool
- func CanPtr(v reflect.Value) bool
- func CanSlice(v reflect.Value) bool
- func CanString(v reflect.Value) bool
- func CanStruct(v reflect.Value) bool
- func CanTime(v reflect.Value) bool
- func CanUint(v reflect.Value) bool
- func Duration(v reflect.Value) (d time.Duration)
- func Error(v reflect.Value) error
- func Kinds(kinds ...reflect.Kind) string
- func Preset(v reflect.Value) reflect.Value
- func StructValueElem(v reflect.Value, t reflect.Type) (rv reflect.Value, rt reflect.Type, err error)
- func Time(v reflect.Value) (t time.Time)
- func Zero(v reflect.Value) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCaseToUnderscore ¶ added in v1.0.4
CamelCaseToUnderscore converts CamelCase to under_score style.
Copied from: https://gist.github.com/zxh/cee082053aa9674812e8cd4387088301
func CanComplex ¶
CanComplex returns true if reflect value is of type float.
func CanDuration ¶
CanDuration returns true if reflect value is of type time.Duration, else returns false.
NOTE: time.Duration <=> int64
func CanInterface ¶
CanInterface reports whether reflect Interface can be used on reflect value without panicking.
func CanNil ¶
CanNil returns true if reflect value represents a type that can be set to nil, else returns false.
func CanSlice ¶
CanSlice reports whether reflect Slice can be used on reflect value without panicking.
func CanStruct ¶
CanStruct returns true if reflect value represents a nested struct, else returns false.
func Preset ¶
Preset returns concrete value of v in a way that it is ready to be set. If v is a pointer to another type, then it returns the concrete value that the pointer points to. In the case that the pointer is nil (not pointing to anything yet), Preset first has to create zero-value of the type and change the value of the pointer from nil to the address of that zero-value. Then it can returns the concrete value that the pointer points to as well.
Makes sure no pointers points to something concrete, instead of nil.
func StructValueElem ¶
func StructValueElem(v reflect.Value, t reflect.Type) (rv reflect.Value, rt reflect.Type, err error)
StructValueElem follows the pointer v and returns the element it points to, for borth reflect value and reflect type, as well as nil error. If v is not a pointer or not a supported pointer, it returns zero-value reflect value and reflect type as well as an error.
Types ¶
This section is empty.