Documentation
¶
Index ¶
- Variables
- func FileLine(fn interface{}) (file string, line int, fnName string)
- func FlattenMap(m map[string]interface{}) map[string]string
- func FlattenValue(key string, val interface{}, result map[string]string)
- func IsBeanInjectionTarget(t reflect.Type) bool
- func IsBeanType(t reflect.Type) bool
- func IsConstructor(t reflect.Type) bool
- func IsErrorType(t reflect.Type) bool
- func IsFuncType(t reflect.Type) bool
- func IsPrimitiveValueType(t reflect.Type) bool
- func IsPropBindingTarget(t reflect.Type) bool
- func PatchValue(v reflect.Value) reflect.Value
- func ReturnNothing(t reflect.Type) bool
- func ReturnOnlyError(t reflect.Type) bool
Constants ¶
This section is empty.
Variables ¶
var ForbiddenMethod = errors.New("forbidden method")
ForbiddenMethod throws this error when calling a method is prohibited.
var UnimplementedMethod = errors.New("unimplemented method")
UnimplementedMethod throws this error when calling an unimplemented method.
Functions ¶
func FileLine ¶
FileLine returns the file, line number, and function name for a given function. It uses reflection and runtime information to extract these details. 'fn' is expected to be a function or method value.
func FlattenMap ¶
FlattenMap flattens a nested map, array, or slice into a single-level map with string keys and string values. It recursively processes each element of the input map and adds its flattened representation to the result map.
func FlattenValue ¶
FlattenValue flattens a single value (which can be a map, array, slice, or other types) into the result map.
func IsBeanInjectionTarget ¶
IsBeanInjectionTarget returns true if the provided type t is a valid target for bean injection. This includes maps, slices, arrays, or any other bean type (including pointers to structs).
func IsBeanType ¶
IsBeanType returns true if the provided type t is considered a "bean" type. A "bean" type includes a channel, function, interface, or a pointer to a struct.
func IsConstructor ¶
IsConstructor returns true if the provided function type t is a constructor. A constructor is defined as a function that returns one or two values. If it returns two values, the second value must be an error.
func IsErrorType ¶
IsErrorType returns true if the provided type t is an error type, either directly (error) or via an implementation (i.e., implements the error interface).
func IsFuncType ¶
IsFuncType returns true if the provided type t is a function type.
func IsPrimitiveValueType ¶
IsPrimitiveValueType returns true if the provided type t is a primitive value type, such as int, uint, float, bool, or string.
func IsPropBindingTarget ¶
IsPropBindingTarget returns true if the provided type t is a valid target for property binding. This includes primitive value types or composite types (such as array, slice, map, or struct) where the elements are primitive value types.
func PatchValue ¶
PatchValue modifies an unexported field to make it assignable by modifying the internal flag. It takes a reflect.Value and returns the patched value that can be written to. This is typically used to manipulate unexported fields in struct types.
func ReturnNothing ¶
ReturnNothing returns true if the provided function type t has no return values.
func ReturnOnlyError ¶
ReturnOnlyError returns true if the provided function type t returns only one value, and that value is an error.
Types ¶
This section is empty.