Documentation ¶
Index ¶
- Variables
- func BuildTypeName(t reflect.Type) string
- func FormatValue(value interface{}) string
- func InvokeMethod(target interface{}, name string, args ...interface{}) ([]reflect.Value, error)
- func IsMethodNotFound(err error) bool
- func IsPrimitiveValue(v reflect.Value) bool
- func JSONMergeStruct(dest, src interface{})
- func ReflectRecursive(v reflect.Value, visitor visitorFunc) error
- func RegisterPrinter(p Printer)
- func ValueAsString(value reflect.Value) string
- type MethodNotFoundError
- type Printer
Constants ¶
This section is empty.
Variables ¶
View Source
var SkipReflection = errors.New("skip this value")
Functions ¶
func BuildTypeName ¶
func FormatValue ¶
func FormatValue(value interface{}) string
FormatValue returns a string representing the value
func InvokeMethod ¶
InvokeMethod calls the specified method by reflection
func IsMethodNotFound ¶
func IsPrimitiveValue ¶
IsPrimitiveValue returns true if passed a value of primitive type: int, bool, etc Note that string (like []byte) is not treated as a primitive type
func JSONMergeStruct ¶ added in v1.19.0
func JSONMergeStruct(dest, src interface{})
JSONMergeStruct merges src into dest It uses a JSON marshal & unmarshal, so only fields that are JSON-visible will be copied
func ReflectRecursive ¶
ReflectRecursive calls visitor with v and every recursive sub-value, skipping subtrees if SkipReflection is returned
func RegisterPrinter ¶
func RegisterPrinter(p Printer)
RegisterPrinter adds a custom printer function
func ValueAsString ¶
ValueAsString returns a human-readable string representation of the passed value
Types ¶
type MethodNotFoundError ¶
type MethodNotFoundError struct { Name string Target interface{} }
func (*MethodNotFoundError) Error ¶
func (e *MethodNotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.