Documentation
¶
Index ¶
- Variables
- func AllOfList[T any](l *list.List) []T
- func FileLine(fn any) (file string, line int, fnName string)
- func FlattenMap(m map[string]any) map[string]string
- func FlattenValue(key string, val any, result map[string]string)
- func FuncName(fn any) 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 ListOf[T any](a ...T) *list.List
- func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
- func OrderedMapKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K
- 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 ErrForbiddenMethod = errors.New("forbidden method")
ErrForbiddenMethod throws this error when calling a method is prohibited.
var ErrUnimplementedMethod = errors.New("unimplemented method")
ErrUnimplementedMethod 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 MapKeys ¶
func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
MapKeys returns the keys of the map m.
func OrderedMapKeys ¶
OrderedMapKeys returns the keys of the map m in sorted order.
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.
Directories
¶
Path | Synopsis |
---|---|
Package goutil provides a safe way to execute goroutines with built-in panic recovery.
|
Package goutil provides a safe way to execute goroutines with built-in panic recovery. |
Package sysconf provides a unified configuration container for the Go programming language.
|
Package sysconf provides a unified configuration container for the Go programming language. |
Package syslog provides simplified logging utilities for tracking the execution flow of the go-spring framework.
|
Package syslog provides simplified logging utilities for tracking the execution flow of the go-spring framework. |