Documentation
¶
Index ¶
- Variables
- func AllOfList[T any](l *list.List) []T
- func FileLine(fn any) (file string, line int, fnName 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 PatchValue(v reflect.Value) reflect.Value
- func PathExists(file string) (bool, error)
- func Ptr[T any](i T) *T
- func ReturnNothing(t reflect.Type) bool
- func ReturnOnlyError(t reflect.Type) bool
- type FloatType
- type IntType
- type UintType
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 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 PathExists ¶ added in v1.2.2
PathExists checks whether the specified file or directory exists. Returns true if the path exists, false if it does not exist, and an error if the check fails for another reason (e.g., permission denied).
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 ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package color provides some console output formats.
|
Package color provides some console output formats. |
|
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. |